马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Free-Lancer 于 2014-10-8 09:55 编辑
包含了 Edit_Box Popup_List List_Box Image_Button Button Radio_button Toggle 几个控件,用来测试图形交互及组件关联,目前仅是界面,关联函数还没有完成
和 ODCL 相比,增加了 手动写 DCL 代码部分,控件事件不管是 DCL 还是 ODCL 都要老老实实一个个写,ODCL 不过是给你自动定义了事件名函数称,具体代码还是要一字一字的码
DCL纵然有百般缺点,但也不是一无是处,轻量,和 ACAD 融合更好更通用,函数简单
至于编写,其实克服畏难心理更重要,仔细分析下 DCL 构成,不就是 Lisp 的嵌套表吗,{ { { } } } , 把这个大括号想象成 ( ( ( ) ) ) 不就简单了!
在 Vlide 里像写 Lisp 语句一样写 DCL 无需借助其他编辑器!
- (defun c:tt (/ _k2_callback _k4_callback _k5_callback
- _k6_callback strl fn id
- radioKlst buttonKlst editKlst toggleKlst
- listKlst imageKlst lyrlst linetypelst
- what_next
- )
- (defun _k4_callback ()
- (xd::dcl:seterror "hello")
- )
- (setq strl '("temp:dialog {"
- "label = \"XD::DCL:xxx Func Test\";"
- " :row{"
- " :column {"
- " :row{"
- " :popup_list { label = \"Layer\"; key = \"p1\";}"
- " :popup_list { label = \"Linetype\"; key = \"p2\";}"
- " }"
- " :row {"
- " :list_box { label = \"Numb\"; width = 8; heitht = 15; key = \"l1\";}"
- " :list_box { label = \"Dist\"; width = 8; heitht = 15; key = \"l2\";}"
- " }"
- " :row {"
- " :boxed_radio_row {"
- " label = \"option1\";"
- " :radio_button { label = \"change\"; key = \"r1\";}"
- " :radio_button { label = \"undo\"; key = \"ur\";}"
- " }"
- " :boxed_radio_row {"
- " label = \"option2\";"
- " :radio_button { label = \"unc\"; key = \"r2\";}"
- " :radio_button { label = \"redo\"; key = \"r3\";}"
- " }"
- " }"
- " :boxed_row {"
- " label = \"Input\";"
- " :edit_box { key = \"k1\";}"
- " :text { key = \"s1\"; width = 4; value = \"\";}"
- " :edit_box { key = \"k2\";}"
- " :text { width = 4; value = \"=\";}"
- " :edit_box { key = \"k3\";}"
- " }"
- " :boxed_row{"
- " label = \"Toggle\";"
- " :toggle { label = \"t1\"; key = \"t1\";}"
- " :toggle { label = \"t2\"; key = \"t2\";}"
- " :toggle { label = \"t3\"; key = \"t3\";}"
- " :toggle { label = \"t4\"; key = \"t4\";}"
- " }"
- " :boxed_row{"
- " label = \"button option\";"
- " :button { label = \"calc\"; key = \"k4\";}"
- " :button { label = \"Pick\"; key = \"k5\";}"
- " :button { label = \"select\"; key = \"k6\";}"
- " }"
- " }"
- " :boxed_column {"
- " label = \"Image Button Test\";"
- " :image_button {width = 18; height = 8; key = \"i1\";}"
- " :image_button {width = 18; height = 8; key = \"i2\";}"
- " :image_button {width = 18; height = 8; key = \"i3\";}"
- " }"
- " }"
- " :row {"
- " :text {width = 6; value = \"Color\";}"
- " :image_button { width = 4; fixed_width = true; key = \"col\";}"
- " spacer_1;"
- " ok_cancel;"
- " }"
- " errtile;"
- "}"
- )
- radioKlst '(("r1" "ur") ("r3" "r4"))
- listKlst '("p1" "p2" "l1" "l2")
- editKlst '("k1" "k2" "k3")
- buttonKlst '("k4" "k5" "k6")
- toggleKlst '("t1" "t2" "t3" "t4")
- imageKlst '("i1" "i2" "i3" "i4")
- lyrlst (mapcar 'car (xd::object:get "laery"))
- linetypelst (mapcar 'car (xd::object:get "ltype"))
- fn (xd::dcl:make strl)
- id (xd::dcl:load fn "temp") ;_加载
- what_next 2
- )
- (while (>= what_next 2)
- (XD::Dcl:ButtonAction
- '("k4" "k2" "k5" "k6" "k1" "k3")
- '("_k4_callback")
- )
- (xd::dcl:accept) ;_加载后先设置默认、定义动作
- (setq what_next (xd::dcl:show)) ;_设置完成后显示对话框,控制权交DCL
- )
- (xd::dcl:unload id fn);_卸载、删除对话框
- (mapcar '(lambda (x) (set (read x) nil))
- (append radioKlst listKlst editKlst
- buttonKlst toggleKlst imageKlst
- )
- ) ;_不记录默认值时统一释放变量
- (princ)
- )
|