乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 23|回复: 8

[编程交流] DCL功能取代警报

[复制链接]

9

主题

26

帖子

17

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 22:46:34 | 显示全部楼层 |阅读模式
大家好,
正如您所知,警报功能在windows中有一些问题。。。我认为最好有一个DCL函数-由比我更有lisp经验的人制作-以更好的排列方式查看文本-那么,有什么帮助吗?知道吗?我想用这个函数有时显示一条大消息(15-20行…)。
谢谢
(也许李会说一些关于这件事……)
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 22:57:15 | 显示全部楼层
李确实
回复

使用道具 举报

9

主题

26

帖子

17

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 23:01:40 | 显示全部楼层
李的功能是完美的,但正如我所说,有时我想显示一个大消息,许多行和长行。。。。
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 23:10:19 | 显示全部楼层
如果你感兴趣的话,我的老朋友。
 
  1. (defun Alertme (strings / *error* d file str dc go lst go)
  2. (defun *error* (x)
  3.    (if (and d (setq d (findfile d)))
  4.      (vl-file-delete d)
  5.    )
  6.    (princ "\n*Cancel*")
  7. )
  8. ;;                                                            ;;
  9. ;;------------------------------------------------------------;;
  10. ;;  Author: Tharwat Al Shoufi, Copyright © 2013        ;;
  11. ;;------------------------------------------------------------;;
  12. ;;                                                            ;;
  13. (if (and (setq d (vl-filename-mktemp nil nil ".dcl")) (setq file (open d "w")))
  14.    (progn
  15.      (foreach str
  16.               (list
  17.                 "siren : dialog { label = "AutoCAD Message"; width = 32;"
  18.                 (apply 'strcat
  19.                        (mapcar '(lambda (x) (strcat ": text { label = "" x ""; alignment = centered; }")) strings)
  20.                 )
  21.                 ": button { label = "Okay"; key = "oki"; width = 13; fixed_width = true; height = 1.75; fixed_height = true; alignment = centered; is_default = true; }}"
  22.               )
  23.        (write-line str file)
  24.      )
  25.      (close file)
  26.    )
  27.    (alert "Can't load the temporary file <!>")
  28. )
  29. (if (or (not d) (not (< 0 (setq dc (load_dialog d)))) (not (new_dialog "siren" dc)))
  30.    (progn (if (< 0 dc)
  31.             (unload_dialog dc)
  32.           )
  33.           (if (and d (findfile d))
  34.             (vl-file-delete d)
  35.           )
  36.    )
  37.    (progn (start_dialog) (unload_dialog dc) (vl-file-delete d))
  38. )
  39. (princ)
  40. )

 
函数的使用。
 
  1. (Alertme (list "" "Object Name: LINE" "Layer: Defpoints" "Space: Model space" "Handle = 1f2" "Length = 508.9013," ""))
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 23:20:13 | 显示全部楼层
  1. (setq s
  2. ";;-------------------------=={ Popup }==----------------------;;
  3. ;;                                                            ;;
  4. ;;  Displays a pop-up message box prompting the user.         ;;
  5. ;;------------------------------------------------------------;;
  6. ;;  Author: Lee Mac, Copyright © 2012 - www.lee-mac.com       ;;
  7. ;;------------------------------------------------------------;;
  8. ;;  Arguments:                                                ;;
  9. ;;  title - Text to be displayed in the pop-up title bar      ;;
  10. ;;  msg   - Text content of the pop-up message box            ;;
  11. ;;  flags - Integer indicating icon & button appearance       ;;
  12. ;;          Reference: http://lee-mac.com/popup.html          ;;
  13. ;;------------------------------------------------------------;;
  14. ;;  Returns:  Integer indicating the button pressed to exit   ;;
  15. ;;------------------------------------------------------------;;
  16. (defun LM:Popup ( title msg flags / wsh res )
  17.    (if (setq wsh (vlax-create-object "wscript.shell"))
  18.        (progn
  19.            (setq res (vl-catch-all-apply 'vlax-invoke-method (list wsh 'popup msg 0 title flags)))
  20.            (vlax-release-object wsh)
  21.            (if (null (vl-catch-all-error-p res))
  22.                res
  23.            )
  24.        )
  25.    )
  26. )"
  27. )
  28. (LM:Popup "test" s 1)
234640x19o5grw9myg929w.png
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-5 23:27:31 | 显示全部楼层
另一种方法是查看DOSLib免费软件实用程序提供的函数(dos\u msgbox、dos\u msgboxx、dos\u msgboxchk)。
回复

使用道具 举报

1

主题

20

帖子

12

银币

初来乍到

Rank: 1

铜币
14
发表于 2022-7-5 23:39:00 | 显示全部楼层
显示大而烦人的消息框不是一个好主意。如果用户需要帮助,可以使用help或setfunhelp函数。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 23:40:59 | 显示全部楼层
非常感谢Stefan的推荐
 
另一种方法是使用禁用的列表框磁贴,如本程序所示。
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 23:51:19 | 显示全部楼层
如果需要显示>100行的超长按摩,那么我们需要滚动条:
(textscr)*抱歉,不是DCL
  1. (defun pop ( l );
  2. (repeat 300 (princ "\n")); clear the text screen
  3. (textscr)
  4. (foreach x l
  5.    (terpri)
  6.    (princ x))
  7. (repeat 10 (princ "\n"))
  8. (princ))

 
;例子:
(setq a’(“(defun弹出窗口(l)”
“(重复500(princ \“\\n\”);清除textpage屏幕”
“(文本选择)”
“(外汇x l”
“(解释)”
“(普林斯x”)”
“(普林斯)”
))
 
(pop a)
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 02:57 , Processed in 0.569853 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表