我也对dcl lisp连接感兴趣,但我一直在从编辑框中获取值:
- (defun C:test ( / LstDCL FpathWithFname fileDCL dcl_id dlgRtn Prefix$ Suffix$)
- (setq LstDCL
- (list
- "PrefSuff : dialog"
- "{"
- "label = "PF";"
- ": boxed_column"
- "{"
- "label = "--< Add >--";"
- ": edit_box"
- "{"
- "label = "Type prefix:";"
- "key = "pre";"
- "edit_width = 10;"
- "}"
- ": edit_box"
- "{"
- "label = "Type suffix:";"
- "key = "suf";"
- "edit_width = 10;"
- "}"
- ": spacer"
- "{height = 0.5;}"
- "}"
- "ok_cancel;"
- "}"
- ); list
- ); setq LstDCL
- (setq FpathWithFname (vl-filename-mktemp nil nil ".dcl")); studied from LM
- (setq fileDCL (open FpathWithFname "w"))
- (foreach x LstDCL (write-line x fileDCL))
- (close fileDCL)
- ; Load Dialog
- (setq dcl_id (load_dialog FpathWithFname))
- (and (not (new_dialog "PrefSuff" dcl_id))(exit))
- [color="red"]; UNCLEAR what to do below:
- ; Set Dialog Initial Settings
- (set_tile "pre" Prefix$)
- (set_tile "suf" Suffix$)
- ; Dialog Actions
- (action_tile "pre" "(setq Prefix$ $value)")
- (action_tile "suf" "(setq Suffix$ $value)")
- (if (setq dlgRtn (start_dialog))
- (progn
- (cond
- ((= 1 dlgRtn) ; ok was pressed
- (alert (vl-princ-to-string Prefix$))
- (alert (vl-princ-to-string Suffix$))
- (done_dialog)
- )
- ((= 0 dlgRtn) ; cancel was pressed
- (done_dialog)
- )
- )
- ; Unload Dialog
- (unload_dialog dcl_id)
- (vl-file-delete FpathWithFname)
- ); progn
- ); if[/color]
- (princ)
- );| defun |; (vl-load-com) (princ)
不知道在代码的红色部分到底要做什么,有什么帮助吗? |