DCL功能取代警报
大家好,正如您所知,警报功能在windows中有一些问题。。。我认为最好有一个DCL函数-由比我更有lisp经验的人制作-以更好的排列方式查看文本-那么,有什么帮助吗?知道吗?我想用这个函数有时显示一条大消息(15-20行…)。
谢谢
(也许李会说一些关于这件事……) 李确实 李的功能是完美的,但正如我所说,有时我想显示一个大消息,许多行和长行。。。。 如果你感兴趣的话,我的老朋友。
(defun Alertme (strings / *error* d file str dc go lst go)
(defun *error* (x)
(if (and d (setq d (findfile d)))
(vl-file-delete d)
)
(princ "\n*Cancel*")
)
;; ;;
;;------------------------------------------------------------;;
;;Author: Tharwat Al Shoufi, Copyright © 2013 ;;
;;------------------------------------------------------------;;
;; ;;
(if (and (setq d (vl-filename-mktemp nil nil ".dcl")) (setq file (open d "w")))
(progn
(foreach str
(list
"siren : dialog { label = \"AutoCAD Message\"; width = 32;"
(apply 'strcat
(mapcar '(lambda (x) (strcat ": text { label = \"" x "\"; alignment = centered; }")) strings)
)
": button { label = \"Okay\"; key = \"oki\"; width = 13; fixed_width = true; height = 1.75; fixed_height = true; alignment = centered; is_default = true; }}"
)
(write-line str file)
)
(close file)
)
(alert "Can't load the temporary file <!>")
)
(if (or (not d) (not (< 0 (setq dc (load_dialog d)))) (not (new_dialog "siren" dc)))
(progn (if (< 0 dc)
(unload_dialog dc)
)
(if (and d (findfile d))
(vl-file-delete d)
)
)
(progn (start_dialog) (unload_dialog dc) (vl-file-delete d))
)
(princ)
)
函数的使用。
(Alertme (list "" "Object Name: LINE" "Layer: Defpoints" "Space: Model space" "Handle = 1f2" "Length = 508.9013," ""))
(setq s
";;-------------------------=={ Popup }==----------------------;;
;; ;;
;;Displays a pop-up message box prompting the user. ;;
;;------------------------------------------------------------;;
;;Author: Lee Mac, Copyright © 2012 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;;Arguments: ;;
;;title - Text to be displayed in the pop-up title bar ;;
;;msg - Text content of the pop-up message box ;;
;;flags - Integer indicating icon & button appearance ;;
;; Reference: http://lee-mac.com/popup.html ;;
;;------------------------------------------------------------;;
;;Returns:Integer indicating the button pressed to exit ;;
;;------------------------------------------------------------;;
(defun LM:Popup ( title msg flags / wsh res )
(if (setq wsh (vlax-create-object \"wscript.shell\"))
(progn
(setq res (vl-catch-all-apply 'vlax-invoke-method (list wsh 'popup msg 0 title flags)))
(vlax-release-object wsh)
(if (null (vl-catch-all-error-p res))
res
)
)
)
)"
)
(LM:Popup "test" s 1) 另一种方法是查看DOSLib免费软件实用程序提供的函数(dos\u msgbox、dos\u msgboxx、dos\u msgboxchk)。 显示大而烦人的消息框不是一个好主意。如果用户需要帮助,可以使用help或setfunhelp函数。 非常感谢Stefan的推荐
另一种方法是使用禁用的列表框磁贴,如本程序所示。 如果需要显示>100行的超长按摩,那么我们需要滚动条:
(textscr)*抱歉,不是DCL
(defun pop ( l );
(repeat 300 (princ "\n")); clear the text screen
(textscr)
(foreach x l
(terpri)
(princ x))
(repeat 10 (princ "\n"))
(princ))
;例子:
(setq a’(“(defun弹出窗口(l)”
“(重复500(princ \“\\n\”);清除textpage屏幕”
“(文本选择)”
“(外汇x l”
“(解释)”
“(普林斯x”)”
“(普林斯)”
))
(pop a)
页:
[1]