警报输入框
我搜索了我能找到的和找不到的答案。是否有一个类似于“alert”的LISP函数,但它不只是弹出框,而是让用户在那里输入一些东西(而不是在LISP中使用“prompt”? 您可以使用DCL/ODCL或查看DosLib,它有几个输入“警报”样式框。 我觉得写一个例子很有趣:(defun PromptBox ( title msg / dcl dch file val )
;; ------------------------------------------- ;;
;; Arguments:- ;;
;; ------------------------------------------- ;;
;; title - Dialog Box Title ;;
;; msg - Text to Display ;;
;; ------------------------------------------- ;;
;; Returns:- ;;
;; ------------------------------------------- ;;
;; Entered String if user presses OK, else nil ;;
;; ------------------------------------------- ;;
;; Example by Lee Mac 2010-www.lee-mac.com ;;
;; ------------------------------------------- ;;
(cond
(
(not
(and
(setq dcl(vl-filename-mktemp nil nil ".dcl"))
(setq file (open dcl "w"))
(progn
(write-line
(strcat
"promptbox : dialog { label = \"" title "\"; initial_focus = \"txt\"; spacer;"
": edit_box { key = \"txt\"; edit_width = 60; edit_limit = 2048; allow_accept = true; } spacer; ok_cancel; }"
)
file
)
(setq file (close file))
(findfile dcl)
)
)
)
)
(
(<= (setq dch (load_dialog dcl)) 0)
(vl-file-delete dcl)
)
(
(not (new_dialog "promptbox" dch))
(unload_dialog dch)
(vl-file-delete dcl)
)
(t
(if msg (setq val (set_tile "txt" msg)))
(action_tile "txt" "(setq val $value)")
(if (zerop (start_dialog)) (setq val nil))
(unload_dialog dch)
(vl-file-delete dcl)
)
)
val
)或者:
李 好的,我试试。谢谢
非常欢迎JMerch-如果对代码有任何问题,请提问
You're very welcome JMerch - any questions about the code, just ask
页:
[1]