本帖最后由 nonsmall 于 2014-9-17 14:19 编辑
测试代码和核心函数下载- ;nonsmall 作品 可视化DCL新思路
- (defun c:tt( / dcl_id f file i stra)
- ;这里就是你要的排列样式
- (setq stra "nonsmall:dialog{label="可视化DCL";" i 0)
- (setq stra (strcat stra (getdcl dcl)))
- (setq stra (strcat stra "ok_cancel;}"))
- ;把DCL代码写出并且调用观看效果
- (setq file "d:\\test.dcl")
- (if (findfile file)
- (setq f (open "d:\\test.dcl" "w"))
- (setq f (open "d:\\test.dcl" "a"))
- )
- (write-line stra f)
- (close f)
- (setq dcl_id (load_dialog file))
- (new_dialog "nonsmall" dcl_id)
- (start_dialog)
- (unload_dialog dcl_id)
- (startapp "notepad" file)
- (princ)
- )
- (setq dcl '(
- ("群1-2个" "群2-3个" "群3-图")
- ("群4-其他控件")
- ))
- (setq 群1 '(
- ("组1")
- ))
- (setq 组1 '(
- ("单选-单选1")
- ("单选-单选2")
- ))
- (setq 群2 '(
- ("多选-多选1")
- ("多选-多选2")
- ("多选-多选3")
- ))
- (setq 群3 '(
- ("图像")
- ("按钮-按钮")
- ))
- (setq 群4 '(
- ("竖滚动" "群5-嵌套")
- ))
- (setq 群5 '(
- ("横滚动")
- ("下拉")
- ("文字-我的DCL")
- ))
- (princ)
自动生成的DCL代码如下:
- nonsmall:dialog{label="可视化DCL";:row{:boxed_column{ label = "2个";:row{:column{:row{:radio_button{key = "radio3"; label = "单选1" ;}}:row{:radio_button{key = "radio4"; label = "单选2" ;}}}}}:boxed_column{ label = "3个";:row{:toggle{key = "toggle6"; label = "多选1" ;}}:row{:toggle{key = "toggle7"; label = "多选2" ;}}:row{:toggle{key = "toggle8"; label = "多选3" ;}}}:boxed_column{ label = "图";:row{:image_button{key = "list10" ;width = 18.15 ;height = 7.875 ;}}:row{:button{key = "bt11"; label = "按钮" ;}}}}:row{:boxed_column{ label = "其他控件";:row{:slider{key = "list13" ;layout = vertical ;}:boxed_column{ label = "嵌套";:row{:slider{key = "list15" ;layout = horizontal ;}}:row{:popup_list{key = "list16" ;}}:row{:text{key = "txt17"; label = "我的DCL" ;}}}}}}ok_cancel;}
|