工具箱 升级 (改别人的)
本帖最后由 gaomingabc456 于 2017-11-7 17:25 编辑(defun c:xxx ()
(mai_make_panel
(list
(list "AA"
(list"A1""A1");(list按钮标签运行的命令)
(list"A2""A2");(list按钮标签运行的命令)
(list"A3""A3");(list按钮标签运行的命令)
(list"A4""A4");(list按钮标签运行的命令)
(list"A5""A5");(list按钮标签运行的命令)
(list"A6""A6");(list按钮标签运行的命令)
(list"A7""A7");(list按钮标签运行的命令)
(list"A8""A8");(list按钮标签运行的命令)
) ;_ 结束list
(list "BB"
(list"B1""B1");(list按钮标签运行的命令)
(list"B2""B2");(list按钮标签运行的命令)
(list"B3""B3");(list按钮标签运行的命令)
(list"B4""B4");(list按钮标签运行的命令)
(list"B5""B5");(list按钮标签运行的命令)
(list"B6""B6");(list按钮标签运行的命令)
(list"B7""B7");(list按钮标签运行的命令)
(list"B8""B8");(list按钮标签运行的命令)
) ;_ 结束list
(list "CC"
(list"C1""C1");(list按钮标签运行的命令)
(list"C2""C2");(list按钮标签运行的命令)
(list"C3""C3");(list按钮标签运行的命令)
(list"C4""C4");(list按钮标签运行的命令)
(list"C5""C5");(list按钮标签运行的命令)
(list"C6""C6");(list按钮标签运行的命令)
(list"C7""C7");(list按钮标签运行的命令)
(list"C8""C8");(list按钮标签运行的命令)
) ;_ 结束list
(list "DD"
(list"D1""D1");(list按钮标签运行的命令)
(list"D2""D2");(list按钮标签运行的命令)
(list"D3""D3");(list按钮标签运行的命令)
(list"D4""D4");(list按钮标签运行的命令)
(list"D5""D5");(list按钮标签运行的命令)
(list"D6""D6");(list按钮标签运行的命令)
(list"D7""D7");(list按钮标签运行的命令)
(list"D8""D8");(list按钮标签运行的命令)
) ;_ 结束list
) ;_ 结束list
) ;_ 结束mai_mak_panel
(princ)
)
(defun mai_make_panel ( menulist / n num_nobut num_button nn nnn menuname val_lst add_dclrow tt order_lst in num_image)
(defun add_dclrow ( dstr / ) (if dstr (setq val_lst (cons dstr val_lst))))
(setq menuname (strcat (vl-filename-mktemp) "temp_pannel1.dcl"))
(add_dclrow "curbutton:button{width=10;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curimage:image{width=10;height=0.2;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curpanel:dialog{label=\"工具箱 1\";alignment=centered;vertical_margin=none;horizontal_margin=none;")
(add_dclrow ":row{")
(setq len (apply 'max (mapcar 'length menulist))
order_lst (apply 'append (mapcar 'cdr menulist))
num_button 0
num_nobut 0
in 0
num_image 0
)
(foreach nn menulist
(setq in 0)
(add_dclrow (strcat " : boxed_column{label=\"" (car nn) "\";vertical_margin=none; horizontal_margin=none;"))
(foreach nnn (cdr nn)
(setq num_button (1+ num_button)
in (1+ in)
num_image (1+ num_image)
tt (car nnn)
tt (if tt tt "")
)
(add_dclrow (strcat ":curbutton{label=\"" tt "\";key=\"but" (itoa num_button) "\";}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";color=18;}")) (setq in 0)
)
)
)
(repeat (- len (length nn))
(setq num_nobut (1+ num_nobut)
in (1+ in)
num_image (1+ num_image)
)
(add_dclrow (strcat " : curbutton{key=\"butno" (itoa num_nobut) "\";color=-2;}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";}"))
(setq in 0)
)
)
)
(add_dclrow "spacer;}")
)
(add_dclrow "}
:row {
:text {key =\"label1\";width=13.35;height=1.875;fixed_heigh =true;fixed_width=true;}
:button{label=\"退出\";key=\"cancel\";is_cancel=true;width=10;fixed_width=true;alignment=centered;}
:curbutton{label=\"下一页\";key=\"nextl\";width=10;fixed_width=true;alignment=centered;}}}")
(vl-file-delete menuname)
(setq nn (open menuname "w"))
(foreach n (reverse val_lst) (write-line n nn))
(close nn)
(setq nnn (load_dialog menuname))
(if (not (new_dialog "curpanel" nnn)) (exit))
(setq n 0)
(repeat num_nobut (mode_tile (strcat "butno" (itoa num_nobut)) 1) (setq num_nobut (1- num_nobut)))
(foreach nn menulist
(foreach nnn (cdr nn)
(setq n (1+ n)
tt (car nnn)
tt (if tt tt "")
)
(if (= tt "")
(mode_tile (strcat "but" (itoa n)) 1)
(action_tile (strcat "but" (itoa n)) (strcat "\(done_dialog " (itoa n) "\)"))
)
)
)
(action_tile "nextl" "(aaa22)")
(setq nn (start_dialog))
(unload_dialog nnn)
(vl-file-delete menuname)
(if (> nn 0)
(progn (setq tt (cadr (nth (1- nn) order_lst)))
(princ "\n")
(if (= (eval (read (strcat "(type c:" tt ")"))) 'SUBR)
(eval (read (strcat "(c:" tt ")")))
(vl-cmdf tt)
)
)
)
)
(defun aaa22 ()
(mai_make_panel1
(list
(list "OO"
(list"O1""O1");(list按钮标签运行的命令)
(list"O2""O2");(list按钮标签运行的命令)
(list"O3""O3");(list按钮标签运行的命令)
(list"O4""O4");(list按钮标签运行的命令)
(list"O5""O5");(list按钮标签运行的命令)
(list"O6""O6");(list按钮标签运行的命令)
(list"O7""O7");(list按钮标签运行的命令)
(list"O8""O8");(list按钮标签运行的命令)
) ;_ 结束list
(list "PP"
(list"P1""P1");(list按钮标签运行的命令)
(list"P2""P2");(list按钮标签运行的命令)
(list"P3""P3");(list按钮标签运行的命令)
(list"P4""P4");(list按钮标签运行的命令)
(list"P5""P5");(list按钮标签运行的命令)
(list"P6""P6");(list按钮标签运行的命令)
(list"P7""P7");(list按钮标签运行的命令)
(list"P8""P8");(list按钮标签运行的命令)
) ;_ 结束list
(list "QQ"
(list"Q1""Q1");(list按钮标签运行的命令)
(list"Q2""Q2");(list按钮标签运行的命令)
(list"Q3""Q3");(list按钮标签运行的命令)
(list"Q4""Q4");(list按钮标签运行的命令)
(list"Q5""Q5");(list按钮标签运行的命令)
(list"Q6""Q6");(list按钮标签运行的命令)
(list"Q7""Q7");(list按钮标签运行的命令)
(list"Q8""Q8");(list按钮标签运行的命令)
) ;_ 结束list
(list "RR"
(list"R1""R1");(list按钮标签运行的命令)
(list"R2""R2");(list按钮标签运行的命令)
(list"R3""R3");(list按钮标签运行的命令)
(list"R4""R4");(list按钮标签运行的命令)
(list"R5""R5");(list按钮标签运行的命令)
(list"R6""R6");(list按钮标签运行的命令)
(list"R7""R7");(list按钮标签运行的命令)
(list"R8""R8");(list按钮标签运行的命令)
) ;_ 结束list
) ;_ 结束list
) ;_ 结束mai_mak_panel
(princ)
)
(defun mai_make_panel1 ( menulist / n num_nobut num_button nn nnn menuname val_lst add_dclrow tt order_lst in num_image)
(defun add_dclrow ( dstr / ) (if dstr (setq val_lst (cons dstr val_lst))))
(setq menuname (strcat (vl-filename-mktemp) "temp_pannel12.dcl"))
(add_dclrow "curbutton:button{width=10;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curimage:image{width=10;height=0.2;vertical_margin=none;vertical_margin=none;}")
(add_dclrow "curpanel:dialog{label=\"工具箱 2\";alignment=centered;vertical_margin=none;horizontal_margin=none;")
(add_dclrow ":row{")
(setq len (apply 'max (mapcar 'length menulist))
order_lst (apply 'append (mapcar 'cdr menulist))
num_button 0
num_nobut 0
in 0
num_image 0
)
(foreach nn menulist
(setq in 0)
(add_dclrow (strcat " : boxed_column{label=\"" (car nn) "\";vertical_margin=none; horizontal_margin=none;"))
(foreach nnn (cdr nn)
(setq num_button (1+ num_button)
in (1+ in)
num_image (1+ num_image)
tt (car nnn)
tt (if tt tt "")
)
(add_dclrow (strcat ":curbutton{label=\"" tt "\";key=\"but" (itoa num_button) "\";}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";color=18;}")) (setq in 0)
)
)
)
(repeat (- len (length nn))
(setq num_nobut (1+ num_nobut)
in (1+ in)
num_image (1+ num_image)
)
(add_dclrow (strcat " : curbutton{key=\"butno" (itoa num_nobut) "\";color=-2;}"))
(if (= 4 in)
(progn (add_dclrow (strcat ":curimage{key=\"ima" (itoa num_image) "\";}"))
(setq in 0)
)
)
)
(add_dclrow "spacer;}")
)
(add_dclrow "}:button{label=\"退出\";key=\"cancel\";is_cancel=true;width=10;fixed_width=true;alignment=centered;}}")
(vl-file-delete menuname)
(setq nn (open menuname "w"))
(foreach n (reverse val_lst) (write-line n nn))
(close nn)
(setq nnn (load_dialog menuname))
(if (not (new_dialog "curpanel" nnn)) (exit))
(setq n 0)
(repeat num_nobut (mode_tile (strcat "butno" (itoa num_nobut)) 1) (setq num_nobut (1- num_nobut)))
(foreach nn menulist
(foreach nnn (cdr nn)
(setq n (1+ n)
tt (car nnn)
tt (if tt tt "")
)
(if (= tt "")
(mode_tile (strcat "but" (itoa n)) 1)
(action_tile (strcat "but" (itoa n)) (strcat "\(done_dialog " (itoa n) "\)"))
)
)
)
(setq nn (start_dialog))
(unload_dialog nnn)
(vl-file-delete menuname)
(if (> nn 0)
(progn (setq tt (cadr (nth (1- nn) order_lst)))
(princ "\n")
(if (= (eval (read (strcat "(type c:" tt ")"))) 'SUBR)
(eval (read (strcat "(c:" tt ")")))
(vl-cmdf tt)
)
)
)
)
这是老迈的吧:lol 顶一下楼主,改进了哪些内容? 本帖最后由 jun353835273 于 2017-11-13 08:53 编辑
这种改法感觉不是很科学, 可以设定一页显示的行数和列数。在每一页添加 "下一页""返回"的按钮。每次运行调用对话框生成函数就可以了,如果照你现在的改法如果设定了4页,还得搞四个mai_make_panel2 mai_make_panel3 mai_make_panel4 的函数
没学到老迈的精髓,改的和没改看不出区别在那里 http://bbs.mjtd.com/thread-175352-1-1.html看看我这个 支持一下,加油! 学习学习:handshake 请问是否可以把下一页这几个字放到第一个面板退出这几个字的下面吗
页:
[1]