我刚刚从一个网页上复制了一个教程,并试图使其适应我的代码。
这是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个字符。 |