ronjorp,
谢谢你的快速回复。
你的解决方案没有像我想的那样有效。
这个lisp仍然只打印一个副本,而不要求打印数字a副本。
我还将附上lisp的第二部分,该部分将从视图中创建列表。
希望它会更有意义。
谢谢
- ;;Created by Lee Mac
- ;; bit - [int] 1=allow multiple; 2=return indexes
- ;; Returns: [lst] List of selected items/indexes, else nil
- (defun LM:listbox ( msg lst bit / dch des tmp rtn )
- (cond
- ( (not
- (and
- (setq tmp (vl-filename-mktemp nil nil ".dcl"))
- (setq des (open tmp "w"))
- (write-line
- (strcat "listbox:dialog{label="" msg "";spacer;:list_box{key="list";multiple_select="
- (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}"
- )
- des
- )
- (not (close des))
- (< 0 (setq dch (load_dialog tmp)))
- (new_dialog "listbox" dch)
- )
- )
- (prompt "\nError Loading List Box Dialog.")
- )
- ( t
- (start_list "list")
- (foreach itm lst (add_list itm))
- (end_list)
- (setq rtn (set_tile "list" "0"))
- (action_tile "list" "(setq rtn $value)")
- (setq rtn
- (if (= 1 (start_dialog))
- (if (= 2 (logand 2 bit))
- (read (strcat "(" rtn ")"))
- (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")")))
- )
- )
- )
- )
- )
- (if (< 0 dch)
- (unload_dialog dch)
- )
- (if (and tmp (setq tmp (findfile tmp)))
- (vl-file-delete tmp)
- )
- rtn
|