本帖最后由 x_s_s_1 于 2022-3-25 08:59 编辑
关于多个对话框之间的切换,尝试了很久,没有成功,麻烦各位网友相助,谢谢。
举例,一个dcl文件中,包含temp1和temp2两个对话框.1.执行命令aa,显示temp1对话框,其有两个按钮【下一个对话框】【取消】;
2.对话框temp1有两个按钮,当按【取消】时,关闭temp1对话框;
3.当按【下一个对话框】按钮时,关闭temp1对话框,显示temp2对话框;
4.temp2对话框有两个按钮【图中选择】【回前菜单】;
5.当按【图中选择】按钮时,关闭全部对话框,至图中选择一个图元,选择完毕后回到temp2对话框;
6.当按【回前菜单】按钮时关闭temp2对话框,显示temp1对话框;
发帖的时候没条件录屏,补个动图,表达的清楚一些
- (defun c:aa ()
- (setq dcllst '("temp1:dialog {"
- " :button {"
- " key = "bt1" ;"
- " label = "下一个对话框" ;"
- " }"
- " :button {"
- " is_cancel = true ;"
- " key = "bt2" ;"
- " label = "取消" ;"
- " }"
- "}"
- "temp2:dialog {"
- " :button {"
- " key = "bt3" ;"
- " label = "图中选择" ;"
- " }"
- " :button {"
- " is_cancel = true ;"
- " key = "bt4" ;"
- " label = "回前菜单" ;"
- " }"
- "}"
- )
- )
- (setq tmpf (xty-sys-makeFbylst
- (vl-filename-mktemp nil nil ".dcl")
- dcllst
- )
- )
- (setq callback1 2)
- (setq dcl_id (load_dialog tmpf))
- (vl-file-delete tmpf)
- (while (> callback1 1)
- (new_dialog "temp1" dcl_id)
- (action_tile "bt1" "(do_bt1)")
- (action_tile "bt2" "(do_bt2)")
- (setq callback1 (start_dialog))
- (cond ((= 1 callback1) (showtemp2))
- ((= 2 callback1))
- )
- )
- (unload_dialog dcl_id)
- )
- (defun do_bt1 () (done_dialog 1))
- (defun do_bt2 () (done_dialog 2))
- (defun showtemp2 ()
- (setq callback2 2)
- (while (> callback2 1)
- (new_dialog "temp2" dcl_id)
- (action_tile "bt3" "(do_bt3)")
- (action_tile "bt4" "(do_bt4)")
- (setq callback2 (start_dialog))
- (cond ((= 1 callback2))
- ((= 2 callback2))
- )
- )
- )
- (defun xty-sys-makeFbylst (filename strlst / f n)
- (setq f (open filename "w"))
- (foreach n strlst (write-line n f))
- (close f)
- filename
- )
|