现在,保存dcl和lisp文件,然后在AutoCAD中映射到文件夹的路径,在vlide编辑器中加载文件并运行lisp文件,您将看到列表框中的项目高亮显示。在lisp文件中,您将看到将set\u tile设置为列表中的项目,并将mode tile设置为高亮显示它们。您可以创建变量来记住这些。
- [font=Times New Roman][font=Times New Roman](defun test:DialogInput[/font]
- [font=Times New Roman] (/ dcl_id result userclick dialogLoaded dialogShow)[/font]
- [font=Times New Roman] (setq dialogLoaded T[/font]
- [font=Times New Roman]dialogShow T [/font]
- [font=Times New Roman] ) ;_ end of setq[/font]
- [font=Times New Roman] (if (= -1 (setq dcl_id (load_dialog "test.DCL")))[/font]
- [font=Times New Roman] (progn [/font]
- [font=Times New Roman] (princ "\nERROR: Cannot load test.dcl")[/font]
- [font=Times New Roman] (setq dialogLoaded nil)[/font]
- [font=Times New Roman] ) ;_ end of progn[/font]
- [font=Times New Roman] ) ;_ end of if[/font]
- [font=Times New Roman] (if (and (not (new_dialog "test_dlg" dcl_id))[/font]
- [font=Times New Roman] dialogLoaded[/font]
- [font=Times New Roman] ) ;_ end of and[/font]
- [font=Times New Roman] (progn [/font]
- [font=Times New Roman] (princ "\nERROR: Cannot show dialog test.dlg")[/font]
- [font=Times New Roman] (setq dialogShow nil)[/font]
- [font=Times New Roman] ) ;_ end of progn[/font]
- [font=Times New Roman] ) ;_ end of if[/font]
- [font=Times New Roman] (if (and dialogLoaded dialogShow)[/font]
- [font=Times New Roman] (progn[/font]
- [font=Times New Roman] (setq lst1 '("150" "300" "400" "600" "900" "1500" "2500"))[/font]
- [font=Times New Roman] (setq lst2 '("1/2" "3/4" "1" "1-1/4" "1-1/2" "1-3/4" "2"))[/font]
- [font=Times New Roman] (start_list "CLASS" 3) [/font]
- [font=Times New Roman] (mapcar 'add_list lst1);_[/font]
- [font=Times New Roman] (end_list)[/font]
- [font=Times New Roman] (set_tile "CLASS" "2")[/font]
- [font=Times New Roman](mode_tile "CLASS" 3);_[/font]
- [font=Times New Roman] (start_list "PSIZ" 3);_[/font]
- [font=Times New Roman] (mapcar 'add_list lst2) [/font]
- [font=Times New Roman] (end_list)[/font]
- [font=Times New Roman] (set_tile "PSIZ" "2")[/font]
- [font=Times New Roman](mode_tile "PSIZ" 3);_[/font]
- [font=Times New Roman] (action_tile "cancel" "(done_dialog)(setq UserClick nil) ")[/font]
- [font=Times New Roman] (start_dialog) [/font]
- [font=Times New Roman] (unload_dialog dcl_id)[/font]
- [font=Times New Roman] ;_ end of if[/font]
- [font=Times New Roman] ) ;_ end of progn[/font]
- [font=Times New Roman] ) ;_ end of if [/font]
- [font=Times New Roman])[/font]
- [/font]
-
- test_dlg : dialog {
- : row {
- : column {
- : boxed_column {
- label = "Class";
- : list_box {
- key = "CLASS";
- height = 8.0;
- width = 9.0;
- fixed_height = true;
- fixed_width = true;
- alignment = centered;
- }
- }
- }
- : column {
- : boxed_column {
- label = "Size";
- : list_box {
- key = "PSIZ";
- height = 8.0;
- width = 9.0;
- fixed_height = true;
- fixed_width = true;
- alignment = centered;
- }
- }
- }
- }
- : row { // defines the OK/Cancel button row
- : spacer { width = 1; }
- : button { // defines the OK button
- label = "OK";
- is_default = true;
- key = "accept";
- width = 8;
- fixed_width = true;
- }
- : button { // defines the Cancel button
- label = "Cancel";
- is_cancel = true;
- key = "cancel";
- width = 8;
- fixed_width = true;}
- }
- }//_end
|