(defun c:tt();此部分是测试代码用
(紧凑列表_load)
)
(defun 紧凑列表_load( / dcl_id Dialog_Return key keys Dcl_File)
(vl-load-com)
(setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl_紧凑列表))));对话框加载
(vl-file-delete Dcl_File);加载后删除DCL文件
(setq Dialog_Return 2)
(while (> Dialog_Return 1) ;循环控制对话框是否结束
(new_dialog "紧凑列表" dcl_id);建立窗体
;-->-->-对话框初始化->-->--
(setq keys '("Option1" "Option2" "Option3" "Option4" "Option5" "Option6" "accept" "cancel"));列表全部控件名称
(foreach key keys;全部控件的初始化
(if (eval (read (strcat key "_bak"))) (set_tile key (eval (read (strcat key "_bak")))));控件内容
(action_tile key "(Action_紧凑列表_Keys $key $value)");点击动作
)
;--<--<-对话框初始化完成-<--<--
(setq Dialog_Return (start_dialog));开启对话框(用户可见)
)
(unload_dialog dcl_id);退出时卸载对话框
(princ);防止函数回显
)
(defun Action_紧凑列表_Keys (key value) ;全部控件的点击动作触发
(cond
((= key "accept") ;{确认按钮}
(Get_紧凑列表_Data)
(done_dialog 1);对话框退出返回主函数 传递给Dialog_Return值为1
)
((= key "cancel") ;{取消按钮}
(done_dialog 0);对话框退出返回主函数 传递给Dialog_Return值为0
)
((= key "Option1") ; {"Option1"} (单选按钮)
()
)
((= key "Option2") ; {"Option2"} (单选按钮)
()
)
((= key "Option3") ; {"Option3"} (单选按钮)
()
)
((= key "Option4") ; {"Option4"} (单选按钮)
()
)
((= key "Option5") ; {"Option5"} (单选按钮)
()
)
((= key "Option6") ; {"Option6"} (单选按钮)
()
)
)
)
(defun Get_紧凑列表_Data( / key);临时生成Dcl文件 返回文件名
(foreach key keys
(set (read (strcat key "_bak")) (get_tile key));每个控件都赋给一个变量 用于下次开启初始化
)
)
(defun Write_Dcl_紧凑列表( / Dcl_File file str)
(setq Dcl_File (vl-filename-mktemp nil nil ".Dcl"))
(setq file (open Dcl_File "w"))
(foreach str '(
"buttonNoN:button{width=10;horizontal_margin=none;vertical_margin=none;}"
"image_buttonNoN:image_button{fixed_width=true;fixed_height=true;horizontal_margin=none;vertical_margin=none;color = -2;width = 5;aspect_ratio = 1;}"
"imageNoN:image{fixed_width=true;fixed_height=true;horizontal_margin=none;vertical_margin=none;color = -15;width = 5.5;aspect_ratio = 1;}"
"textNoN:text{horizontal_margin=none;vertical_margin=none;}"
"edit_boxNoN:edit_box{horizontal_margin=none;vertical_margin=none;}"
"radio_buttonNoN:radio_button{horizontal_margin=none;vertical_margin=none;}"
"toggleNoN:toggle{horizontal_margin=none;vertical_margin=none;}"
"sliderNoN:slider{horizontal_margin=none;vertical_margin=none;}"
"rowNoN:row{horizontal_margin=none;vertical_margin=none;}"
"columnNoN:column{horizontal_margin=none;vertical_margin=none;}"
"boxed_columnNoN:boxed_column{horizontal_margin=none;vertical_margin=none;}"
"紧凑列表:dialog"
"{"
" label = \"Form1\";"
" :boxed_column"
" {"
" label = \"Frame1\" ;"
" :radio_buttonNoN"
" {"
" key = \"Option1\" ;"
" label = \"Option1\" ;"
" width = 12.15 ;"
" height = 1.275 ;"
" }"
" :radio_buttonNoN"
" {"
" key = \"Option2\" ;"
" label = \"Option2\" ;"
" width = 13.35 ;"
" height = 1.275 ;"
" }"
" :radio_buttonNoN"
" {"
" key = \"Option3\" ;"
" label = \"Option3\" ;"
" width = 13.35 ;"
" height = 1.275 ;"
" }"
" :radio_buttonNoN"
" {"
" key = \"Option4\" ;"
" label = \"Option4\" ;"
" width = 12.15 ;"
" height = 1.275 ;"
" }"
" :radio_buttonNoN"
" {"
" key = \"Option5\" ;"
" label = \"Option5\" ;"
" width = 12.15 ;"
" height = 1.275 ;"
" }"
" :radio_buttonNoN"
" {"
" key = \"Option6\" ;"
" label = \"Option6\" ;"
" width = 13.35 ;"
" height = 1.275 ;"
" }"
" }"
"ok_cancel ;"
"}"
)
(write-line str file)
)
(close file)
Dcl_File
)
;|
/* 自动备份FRM文件内容
VERSION 5.00
Begin VB.Form 紧凑列表
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 2415
Left = 240
TabIndex = 0
Top = 120
Width = 1335
Begin VB.OptionButton Option6
Caption = "Option6"
Height = 255
Left = 120
TabIndex = 6
Top = 2040
Width = 1335
End
Begin VB.OptionButton Option5
Caption = "Option5"
Height = 255
Left = 120
TabIndex = 5
Top = 1680
Width = 1215
End
Begin VB.OptionButton Option4
Caption = "Option4"
Height = 255
Left = 120
TabIndex = 4
Top = 1320
Width = 1215
End
Begin VB.OptionButton Option3
Caption = "Option3"
Height = 255
Left = 120
TabIndex = 3
Top = 960
Width = 1335
End
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 255
Left = 120
TabIndex = 2
Top = 600
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 1215
End
End
End
Attribute VB_Name = "紧凑列表"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
*/
|;