实际上,您可以使用(仅从键盘)在对话框字段之间进行导航–请尝试以下代码:
另存为test\u dclnavigate。AutoCAD搜索路径上的dcl文件:
-
- TESTDIALOG : dialog {
- : edit_box { key = "EditBox1st"; label = "1st Edit Box: "; allow_accept = false; edit_width = 12;}
- : edit_box { key = "EditBox2nd"; label = "2nd Edit Box: "; allow_accept = false; edit_width = 12;}
- : edit_box { key = "EditBox3rd"; label = "3rd Edit Box: "; allow_accept = false; edit_width = 12;}
- ok_only;
- }
另存为test\u dclnavigate。lsp文件:
-
- (defun TestDialogNavigate()
- (setq CodDialog (load_dialog "test_dclnavigate.dcl"))
- (if (not (new_dialog "TESTDIALOG" CodDialog)) (exit))
- (mode_tile "EditBox1st" 2) ;set initial focus to first edit box
- (action_tile "EditBox1st" "(mode_tile "EditBox2nd" 2)") ;switch focus from first to second
- (action_tile "EditBox2nd" "(mode_tile "EditBox3rd" 2)") ;switch focus from second to third
- (action_tile "EditBox3rd" "(mode_tile "accept" 2)") ;set final focus from third to OK
- (action_tile "accept" "(done_dialog 1)")
- (start_dialog)
- (unload_dialog CodDialog)
- (princ)
- )
在代码中,不要忘记为导航中包含的所有字段将allow_accept属性设置为false。
当做 |