DraftSight Lisp - Blank/Empty 对话框锁定

DraftSight Lisp - Blank/Empty Dialog Box Lock

我正在尝试使用教程的解决方案(Link to site). However, when I try to add the first message to the dialog box, the program breaks, and the dialog box opens without any code to close the dialog box. Using task manager to stop DraftSight is the only way I can close the dialog box. Is there an issue with the AutoLisp 我正在使用的代码?

在 DraftSight 中创建一个 Yes/No/Cancel 对话框

参考资料: DraftSight/Solidworks Lisp

Lisp 代码:

;; Source: https://www.afralisp.net/dialog-control-language/tutorials/the-autolisp-message-box.php
;; Lisp code from tutorial
(defun lspYesNoCancel (message1 message2 message3 main)

    (setq msgboxPath "C:\Users\GarrettB\Documents\Visual Studio Code\DraftSight LISP")
    (princ (strcat msgboxPath "\n"))
    (princ)

    ;; Loading the dialoge box file and returning the ID file
    (princ "YesNoCancel 01\n")
    (setq dcl_id (load_dialog (strcat msgboxPath "\" "msgbox.dcl")))
    (princ "YesNoCancel 02\n")

    ;; Creating the dialoge box
    (if (not (new_dialog "lspYesNoCancel" dcl_id "(done_dialog)")) (exit))
    (princ "YesNoCancel 03\n")
    (princ dcl_id)(princ "\n")

    ;; Dialoge Message
    (if (set_tile "message1" message1)(princ "Message added to message1\n")(exit))
    (princ "YesNoCancel 04-1\n")
    (if (set_tile "message2" message2)(princ "Message added to message2\n")(exit))
    (if (set_tile "message3" message3)(princ "Message added to message3\n")(exit))
    (if (set_tile "main" main)(princ "Message added to main\n")(exit))
    (princ "YesNoCancel 04-4\n")

    ;; Command Buttons
    (if (action_tile "no" "(done_dialog) (setq result \"F\")")(princ "No command added\n")(exit))
    (if (action_tile "yes" "(done_dialog) (setq result T)")(princ "Yes command added\n")(exit))
    (if (action_tile "cancel" "(done_dialog) (setq result nil)")(princ "Cancel command added\n")(exit))
    (princ "YesNoCancel 05\n")

    ;; Interaction
    (exit)
    (quit)
    ;; (start_dialog) ;----; Show dialog box
    (unload_dialog dcl_id) ; Closes the link to the .dcl file
    (princ)
)

dcl 代码:

lspYesNoCancel : dialog {
 
    key = "main";
 
    : column {
        : text {Key = "message1";}
        : text {key = "message2";}
        : text {key = "message3";}
    }
    : row {
        : spacer {width = 1;}
        : button {
            label = "Yes";
            key = "yes";
            width = 12;
            fixed_width = true;
            mnemonic = "Y";
            is_default = true;
        }
        : button {
            label = "No";
            key = "no";
            width = 12;
            fixed_width = true;
            mnemonic = "N";
        }
        : button {
            label = "Cancel";
            key = "cancel";
            width = 12;
            fixed_width = true;
            mnemonic = "C";
            is_cancel = true;
        }
        : spacer {width = 1;}
    }
}

在行 : text {Key = "message1";} 中,Key 需要有一个小写的“k”。因此这个 : text {key = "message1";} 是正确答案。