Brick_top 发表于 2022-7-6 08:28:26

使用

您好,我是dcl新手,想知道如何使用dcl输入框设置getstring变量。
 
我以为这很容易,但我还没想出来。
 
谢谢

pBe 发表于 2022-7-6 08:35:57

编辑_框
 
编辑框是一个允许用户输入或编辑单行文本的字段。可选标签可以显示在框的左侧。如果输入的文本长于编辑框的长度,则编辑框将水平滚动。

Brick_top 发表于 2022-7-6 08:43:25

嗨,我在那里搜索了edit_box
 
似乎它将输入文本限制为132个字符。为了避免这种情况?

pBe 发表于 2022-7-6 08:47:34

真正地我从来没有注意到。
 
你能把你的代码贴在这里让我们看看吗?也许我们可以建议一种不同的方法。

Brick_top 发表于 2022-7-6 08:50:28

我刚刚从一个网页上复制了一个教程,并试图使其适应我的代码。
 
这是dcl部分
SAMPLE2 : dialog {
         label = "Pesquisa de Projetos";
         : column {
         : boxed_column {
             : edit_box {
               key = "username";
               label = "Informação a pesquisar:";
               edit_width = 50;
               value = "";
               initial_focus = true;
             }
//            : edit_box {
//                key = "userage";
//                label = "Enter your Age:";
//                edit_width = 15;
//                value = "";
//            }
         }
         : boxed_row {
             : button {
               key = "accept";
               label = " Ok ";
               is_default = true;
             }
             : button {
               key = "cancel";
               label = " Cancel ";
               is_default = false;
               is_cancel = true;
             }
         }
         }

}
 
这是lisp部分
 
(defun saveVars()
(setq userName(get_tile "username"))
;(setq userAge(atoi(get_tile "userage")))
)

(defun C:SAMPLE2()

;;;--- Load the dcl file
(setq dcl_id (load_dialog "SAMPLE2.dcl"))

;;;--- Load the dialog definition if it is not already loaded
(if (not (new_dialog "SAMPLE2" dcl_id))
   (progn
    (alert "The SAMPLE2.DCL file could not be loaded!")
   (exit)
   )
)

;;;--- If an action event occurs, do this function
(action_tile "accept" "(setq ddiag 2)(saveVars)(done_dialog)")
(action_tile "cancel" "(setq ddiag 1)(done_dialog)")

;;;--- Display the dialog box
(start_dialog)

;;;--- Unload the dialog box
(unload_dialog dcl_id)

;;;--- If the user pressed the Cancel button
(if(= ddiag 1)
   (princ "\n Sample2 cancelled!")
)

;;;--- If the user pressed the Okay button
(if(= ddiag 2)
   (progn
   (princ "\n The user pressed Okay!")
   )
)

;;;--- Suppress the last echo for a clean exit
(princ)

)
 
我可以发布我的代码,但它非常特定于图形文件,不知道这是否有帮助。
 
无论如何,在这段代码和这个例子中。结果字符串长度为132个字符。

Brick_top 发表于 2022-7-6 08:57:15

我要试试这个
 
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/DCL-Edit-Box-Maximum-Characters-Limit/td-p/1115925

Brick_top 发表于 2022-7-6 08:58:54

美好的我无法设定限制
 
edit_limit=(数字);
 
不带“()”

Brick_top 发表于 2022-7-6 09:05:34

我试过了
 
edit_limit=512;
 
而且效果很好

Brick_top 发表于 2022-7-6 09:10:33

但现在有件事困扰着我。
 
无论如何,我可以增加编辑框的大小,以便在键入时所有字符都可见?

Lee Mac 发表于 2022-7-6 09:17:44

使用edit_width
页: [1] 2
查看完整版本: 使用