WPerciful 发表于 2022-7-6 00:30:13

DCL问题

关于我写的对话框,我有两个问题。
1.下拉框不够宽,无法显示所有文本。我该如何解决这个问题?
2.目前,要在列表框中选择第二行,必须按住shift键。我如何更改它,使选择保持选中状态而不按下控制键?
 
扰乱dcl的命令
(defun c:bprint ( / )
(setq retlist1 nil)
;;;       lm:directorydialog
;;;Author: Lee Mac, Copyright © 2013 - www.lee-mac.com       ;;;
(setq thedirectory (lm:directorydialog "Select folder: " nil 0))
(if (/= thedirectory nil)
        (setq List1 (vl-directory-files thedirectory "*.dwg"))
        end
)
(setq List2 (list ""))
(batch thedirectory List1 List2)
(if (/= retlist1 nil)
        (progn
                (if (/= (findfile "BPlotData.txt") nil)
                        (setq filedata
                                (readfile
                                        (findfile "BPlotData.txt")
                                )
                                files (cdr filedata)
                                batchplotfiles (list )
                        )
                )
                (foreach file files
                        (setq batchplotfiles
                                (append batchplotfiles
                                        (list
                                                (strcat "open \"" thedirectory "\\" file "\"(mybatchprint) ZOOM E close Y")
                                        )
                                )
                        )
                )
                (makefile
                        (strcat
                                (strcat "C:\\Users\\" (getvar "loginname") "\\Documents")
                                "\\"
                                "BatchPlot.scr"
                        )
                        batchplotfiles
                )
                (command "_.script"
                        (strcat "C:\\Users\\" (getvar "loginname") "\\Documents\\BatchPlot.scr")
                )
        )
)       
)
 
运行dcl的函数
(defun batch ( mydir lista listb / prin )
(setq dir mydir
        poplist1 (list )
        mylist1 lista
        mylist2 listb
)
(setq poplist1 (getplotters)
        poplist2 (getplotstyles)
)
(if (not (setq dcl_id (load_dialog "batch.dcl")))
        (progn
                (alert "The DCL file could not be loaded!")
                (exit)
        )
        (progn
                (if (not (new_dialog "batch" dcl_id))
                        (progn
                                (alert "The BATCH definition could not be loaded!")
                                (exit)
                        )
                        (progn
                               
                                (start_list "poplist1" 3)
                                (mapcar 'add_list poplist1)
                                (end_list)

                                (start_list "poplist2" 3)
                                (mapcar 'add_list poplist2)
                                (end_list)
                               
                                (start_list "mylist1" 3)
                                (mapcar 'add_list mylist1)
                                (end_list)
                               
                                (action_tile "pickdir" " (setq pickdir \"Yes\")(done_dialog 1)")
                                (action_tile "accept" "(saveVars)(done_dialog 2)")
                                (action_tile "cancel" "(done_dialog 3)")
                               
                                (setq ddiag (start_dialog))
                               
                                (unload_dialog dcl_id)
                               
                               
                                (if (= ddiag 1)
                                        (princ "\nSelect directory . . . ")
                                )
                               
                                (if (= ddiag 2)
                                        (princ "\nPlease wait. . . ")
                                )
                               
                                (if (= ddiag 3)
                                        (princ "\nBatch print has been cancelled! ")
                                )
                        )
                )
        )
)
(princ)
)
 
 
数据链路连接器代码
batch
: dialog
{
:        boxed_column
{
        : row
        {
                : popup_list
                {
                        label ="Choose printer";
                        key = "poplist1";
                        height = 15;
                        width = 30;
                        multiple_select = true;
                        fixed_width_font = true;
                        value = "0";
                }
        }
        : row
        {
                : popup_list
                {
                        label ="Choose plot style table";
                        key = "poplist2";
                        height = 15;
                        width = 30;
                        multiple_select = true;
                        fixed_width_font = true;
                        value = "0";
                }
        }
        : list_box
        {
                label ="Choose Item";
                key = "mylist1";
                height = 15;
                width = 25;
                multiple_select = true;
                fixed_width_font = true;
                value = "";
        }
        : row
        {
                : button
                {
                        key = "accept";
                        label = " Print ";
                        is_default = true;
                }
                : button
                {
                        key = "cancel";
                        label = " Cancel ";
                        is_default = false;
                        is_cancel = true;
                }
        }
}
}

BIGAL 发表于 2022-7-6 00:43:42

问题1
这就是答案

ymg3 发表于 2022-7-6 00:48:43

关于问题2,
 
这种行为是在列表框中进行选择的标准方式。
 
它是硬编码到列表框中的,没有写自己的
这很难改变,当然也不可取。
 
ymg公司

Tharwat 发表于 2022-7-6 00:54:27

要增加DCL文件的宽度,只需添加属性width=66;你喜欢在文件顶部和第一个括号之后的任何数字,但不要超过100左右。
为了避免使用控制按钮进行多次选择,只需删除属性multiple\u select=true;从列表框中。
 
注意:同时从popup\u列表中删除multiple\u select属性,因为popup\u列表中不支持以前的属性。

ymg3 发表于 2022-7-6 01:03:15

 
塔尔瓦特,
 
我不知道我是否误解了,但我相信WPerciful想要的是能够选择多个,但不需要按Control或Shift。
 
ymg公司

Tharwat 发表于 2022-7-6 01:09:37

 
让我们等待OP的回应

WPerciful 发表于 2022-7-6 01:15:49

 

 
 
我不知道该在哪里改变。

ymg3 发表于 2022-7-6 01:25:03

 
正如Tharwat告诉您的那样,文件顶部的宽度(参见下面代码窗口中的示例)
 
对于多个选择,最好忘记这一个。反对总是一个坏主意
标准接口。
 
ymg公司
 

batch
: dialog{
       width = 66;
:        boxed_column
{
        : row
        {
                : popup_list
                {
                        label ="Choose printer         ";
                        key = "poplist1";
                        height = 15;
                        width = 30;
                        multiple_select = true;
                        fixed_width_font = true;
                        value = "0";
                }
        }

Lee Mac 发表于 2022-7-6 01:35:17

 
这是可能的,但你必须自己滚。。。
 
[颜色=绿色];;多个列表框选择,不使用CTRL/SHIFT-Lee-Mac;;仅用于学术目的;不用于商业应用。(defunc:示例(/*错误*cnt dch dcl des sel)(defun*错误*(msg)(if(='文件(类型des))(关闭des))(
页: [1]
查看完整版本: DCL问题