TA的每日心情 | 开心 2024-8-31 15:58 |
---|
签到天数: 89 天 [LV.6]常住居民II
管理员
- 积分
- 3366
|
toggle.lsp:
[code]
;功能:演示 1、 toggle控件的使用。2、通过toggle修改text控件的值。3、通过控件设置系统变量
;所需文件包括: toggle.lsp toggle.dcl
;
;加载步骤:
;1、加载lsp
;2、命令行输入 test
(defun c:test( / continue curBtn dlgId )
(defun toggle_action ()
(setq text (strcat "正交:" orth "捕捉:" sna))
(set_tile "mytext" text);设置text控件
(setvar "orthomode" (atoi orth)) ;设置环境变量
(setvar "snapmode" (atoi sna)) ;
)
(setq dlgId (load_dialog "toggle.dcl"))
(if (not (new_dialog "a" dlgId))
(exit)
)
(setq orth (itoa (getvar "orthomode"))) ;获取环境变量的值并赋值给orth
(set_tile "tog1" orth)
(setq sna (itoa (getvar "snapmode")))
(set_tile "tog2" sna)
(action_tile "tog1" "(setq orth $value)(toggle_action)") ;为toggle控件设置处理程序
(action_tile "tog2" "(setq sna $value)(toggle_action)")
(toggle_action)
(start_dialog)
(cond ((= curBtn "btn1") (f1))
((= curBtn "cancel") (setq continue nil))
)
(unload_dialog dlgId)
)
[/code]
toggle.dcl:
[code]a:dialog{
label="slider";
:boxed_row { //*define boxed row
:toggle { //*define toggle
key = "tog1"; //*give it a name
label = "正交 开/关"; //*give it a label
} //*end toggle
:toggle { //*define toggle
key = "tog2"; //*give it a name
label = "捕捉 开/关"; //*give it a label
} //*end definition
}
:text{
key="mytext";
}
:row{
:button{
key="okBtn";
label="确定";
}
:cancel_button{
label="关闭";
}
}
}
[/code] |
|