明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 8371|回复: 55

[提问] 怎么在面板标题头上 加入 <日期+星期+当前时间>

[复制链接]
发表于 2018-10-27 13:59 | 显示全部楼层 |阅读模式
本帖最后由 纵横八方 于 2018-10-31 09:53 编辑

已搞定,多谢大师们指导

    (defun SHUIDAOPAN_make_dcl (/ lst_str str file f)(setq lst_str '(
          "SHUIDAOPAN:dialog{label=\"【面板】\";"
          ":column{"
          ":button {label=\"命令01\";key=\"ML001\";width=15.00;height=1.80;vertical_margin=none;horizontal_margin=none;}"
          ":button {label=\"命令02\";key=\"ML002\";width=15.00;height=1.80;vertical_margin=none;horizontal_margin=none;}"


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2018-10-28 10:28 | 显示全部楼层
‘提问题’还要钱?没道理
回复 支持 1 反对 0

使用道具 举报

发表于 2020-9-29 21:04 | 显示全部楼层
你好,请教一下,怎么在这个面板下边的帮助按钮旁边增加一个按钮,点击这个按钮就打开指定位置的其它vlx文件?
我加入下边这句之后,可以用快捷命令启动指定的程序,但是点击按钮没反应,按钮那个地方应该怎么写?
(defun c:***() (if (null c:***) (load "D:/***.VLX"))(c:***));打开其它程序

这个地方应该怎么写,才能让点击按钮也能够启动指定的程序?
   ":button{key = \"c:***\";label = \"批量打印\";}\n"

另一个问题,我加载了一个外部程序之后,加载第二个的话,
提示说“出现硬错误 ***
已达内部堆栈限制 (模拟)”

最后我想在左下角增加时间,应该怎么写,能说一下吗。我试了帖子里说的那些,都不出现时间,应该是我写的不对。

谢谢了

下边是源码
(defun Dcl-ButtonM (titl buttons flag / a b c)
   (defun strsplist (str / i)
     (if (setq i (vl-string-search " " str))
       (list (substr str 1 i)
                                 (vl-string-trim " " (substr str (+ 2 i)))
       )
                 )
   )
   (defun makedcl (str_lst / fileID dclHandle)
     (setq
                         dclfile (vl-filename-mktemp nil nil ".dcl")
                         fileID  (open dclfile "w")
     )
     (cond
                         ((= (type str_lst) 'str)
                                 (write-line str_lst fileID)
                         )
                         ((= (type str_lst) 'list)
                                 (foreach n str_lst (write-line n fileID))
                         )
                 )
                 (close fileID)
                 (setq dclHandle (load_dialog dclfile))
         )
         (setq
                 b (if flag
                                 ":column{label = \""
                                 (strcat
                                 ":spacer{ wide=1; fixed_width=true;} \n"
                                 ":spacer{ wide=1; fixed_width=true;} \n"
                                 ":row{label = \""
                                 )
                    )
                 c (if flag
                                 ":row{label = \""
                                 ":column{label = \""
                         )
                 d '("ESC")
                 a (strcat (vl-string-translate
                                                                 "$~"
                                                                 "AB"
                                                                 (vl-filename-base (vl-filename-mktemp))
                                                         )
                                 ":dialog{label=\""
                                 titl
                                 "\";\n"
                                 b
                                 "\";\n"
                         )
   )
   (foreach x buttons
     (if (listp x)
       (progn
         (setq a (strcat a c (car x) "\";\n"))
         (foreach y (last x)
           (setq
                                                 b (strsplist y)
                                                 a (if b
                                                                 (strcat a
                                                                         ":button {key =\""
                                                                         (car b)
                                                                         "\";label=\""
                                                                         (last b)
                                                                         "\";}\n"
                                                                 )
                                                                 (strcat a "spacer_0;\n")
                                                         )
                                                 d (if (/= (car b) nil)
                                                                 (cons (car b) d)
                                                                 d
                                                         )
           )
         )
         (setq a (strcat a "}\n"))
       )
       (setq a (strcat a "spacer_0;\n"))
     )
   )
         (setq
                 d    (cdr (REVERSE d))
                 a    (strcat a
                                          "}"
                                          ":text{key=\"str\";label=\"文字\";}"
                                          ":row{"
                                          ":spacer { width = 60; } "
                                          ":button{key = \"c:***\";label = \"批量打印\";}\n"
                                          ":button{key = \"HLP\";label = \"帮助\";}\n"
                                          ":button{key=\"ESC\";label=\"取消\";is_cancel = true;}}}"
                                  )
                 dcl  (makedcl a)
                 lst1 '()
                 i    1
   )
   (foreach key d
     (setq
                         tx   (strcat "(action_tile \""
                                                  key
                                                  "\"\"(done_dialog "
                                                  (itoa i)
                                                  ")\")"
                                          )
                         lst1 (cons tx lst1)
                         i    (1+ i)
     )
   )
   (new_dialog (substr a 1 8) dcl)
   (action_tile "ESC" "(done_dialog 0)")
   (action_tile "HLP" "(alert\"帮助\")")
   (eval (read (strcat "(progn" (apply 'strcat lst1) ")")))
   (setq ctl (start_dialog))
   (UNLOAD_DIALOG dcl)
   (vl-file-delete dclfile)
         (if (/= ctl 0)
     (eval (read (strcat "(c:" (nth (- ctl 1) d) ")")))
   )
)
(defun c:tt (/ lst)
   (setq        lst '(
                         ("命令"
                                 ("0 改为0层  "
                         )
                         ("视口"
                                 ("ZZ 视口比例 "
                         )

                )
   )        
  (Dcl-ButtonM "xx工具箱 " lst nil)
         (princ)
)
发表于 2018-11-3 18:40 | 显示全部楼层
Show Time example

  1. (defun c:t1 (/ dcl fn f time)
  2.   (if (and (setq time (menucmd "M=$(edtime,0,YYYY/MO/DD HH:MM DDDD)")
  3.                  fn   (strcat (getvar 'tempprefix) "tmp.dcl")
  4.                  )
  5.            (setq f (open fn "w"))
  6.            (write-line
  7.              (strcat "test:dialog  {label=\"面板时间 : "   time
  8.                      "\" ;  "                               " :boxed_column { label = \""
  9.                      time                               "\" ;"
  10.                      " :column { :row { :button { key = \"t1\" ;label = \""
  11.                      time                               "\" ;width = 5 ; }}}}"
  12.                      "ok_cancel; "                       " :text { label = \""
  13.                      time                               "\"; alignment = centered; }}"
  14.                      )
  15.              f
  16.              )
  17.            )
  18.     (progn (close f)
  19.            (setq dcl (load_dialog fn))
  20.            (new_dialog "test" dcl)
  21.            (action_tile "t1" "(alert time)")
  22.            (action_tile "accept" "(done_dialog)")
  23.            (start_dialog)
  24.            (unload_dialog dcl)
  25.            )
  26.     )
  27.   (princ)
  28.   )
 楼主| 发表于 2018-10-28 09:53 来自手机 | 显示全部楼层
自己顶一下
发表于 2018-10-28 11:25 | 显示全部楼层
本帖最后由 lisperado 于 2018-10-28 14:25 编辑

好像见过但不是LISP,忘了.net还是C#之类或dynamicwrapper更改caption值?.
.
.
编辑:哈哈原来版主1名经币的隐藏内容是关于DCL对话框面板?太简单了! 还以为是AutoCAD图元视窗面板左上角。。。
楼下已有大师解答谢谢!


 楼主| 发表于 2018-10-28 12:32 | 显示全部楼层
bai2000 发表于 2018-10-28 10:28
‘提问题’还要钱?没道理

搞错了 ,是想  1个币求助的
发表于 2018-10-28 12:46 | 显示全部楼层
命令: (menucmd "M=$(edtime,$(getvar,date),YYYY.MO.DD HH:MM DDDD )")
"2018.10.28 12:46 星期日 "
发表于 2018-10-28 22:01 | 显示全部楼层
xshrimp 发表于 2018-10-28 12:46
命令: (menucmd "M=$(edtime,$(getvar,date),YYYY.MO.DD HH:MM DDDD )")
"2018.10.28 12:46 星期日 "

(setq riqi(menucmd "M=$(edtime,$(getvar,date),YYYY.MO.DD HH:MM DDDD )"))
请问怎么把变量riqi放到面板的标题或者面板中呢?
发表于 2018-10-28 22:01 | 显示全部楼层
求教,贱人工具箱中的这个系统时间显示代码怎么写呢

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2018-10-28 22:48 来自手机 | 显示全部楼层
lisperado 发表于 2018-10-28 11:25
好像见过但不是LISP,忘了.net还是C#之类或dynamicwrapper更改caption值?.
.
.

求教一下,怎么写的
发表于 2018-10-28 23:28 来自手机 | 显示全部楼层
  (writ-line riqi fp)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-27 10:37 , Processed in 0.987757 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表