此示例演示如何创建一个简单的对话框,该对话框允许用户单击按钮,然后在图形屏幕中选取一个点。 该对话框使用以下 DCL 定义: hidedcl : dialog { label="Hide Example"; : column { : text { key="message"; label="Click PickMe to pick a point"; fixed_width=true; fixed_height=true; alignment=centered; } :row { ok_only; :retirement_button { label = "PickMe"; key = "hide"; mnemonic = "H"; } } } } 对话框定义定义了用户可以单击的两个按钮。单击“确定”将关闭窗口,而单击“选取”将执行隐藏对话框并提示用户指定点的代码。以下 AutoLISP 代码显示对话框并定义两个按钮磁贴的行为: (defun c:hidedcl (/ dcl_id what_next cnt) (setq dcl_id (load_dialog "hidedcl.dcl")) ; Load the dialog box. (setq what_next 2) (setq cnt 1) (while (>= what_next 2) ; Begin display loop. (if (null (new_dialog "hidedcl" dcl_id)) ; Initialize dialog (exit) ; box, exit if nil ) ; endif ; returned. ; Set action to take if a button is pressed. Either button ; results in a done_dialog call to close the dialog box. ; Each button associates a specific status code with ; done_dialog, and this status code is returned by ; start_dialog. (action_tile "accept" "(done_dialog 1)") ; Set action for OK. (action_tile "hide" "(done_dialog 4)") ; Set action for PickMe. (setq what_next (start_dialog)) ; Display dialog box. (cond ((= what_next 4) ; Prompt user to (getpoint "\npick a point") ; pick pt. ) ((= what_next 0) (prompt "\nuser cancelled dialog") ) ) ) (unload_dialog dcl_id) (princ) ) 注意:该函数一次终止所有对话框,但不返回状态代码,因此应用程序无法区分隐藏嵌套框和由于错误条件而取消框。term_dialog
相关概念父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 14:56
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.