明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1719|回复: 3

[基础] 通用函数- 提醒警告对话框

[复制链接]
发表于 2015-3-13 16:10:07 | 显示全部楼层 |阅读模式
本帖最后由 fl202 于 2015-3-13 16:20 编辑

通用函数 - 提醒警告对话框
我们编程中经常会用到提醒文字: 比如对话框文件的使用帮助,程序的使用方法,计算中的注意事项及技巧,版本说明,联系方式,更新历史说明等等。如果该文字txt1较长,
    使用(alert  txt1) 没有层次感,是段落式的,看起来很费劲。
    使用(print  txt1) 占用命令行较多,可能看不完(我的命令行留了3行)  
因此想到了这个程序。分享出来,不知道对大家有用没有?
使用方法:
(load    "alert1“ )
(alert1   '("warn 1" "warn 2" "warn 3"  "warn 4"   "warn 5"   ) )
  1. (princ "提醒对话框使用方法:(alert1  '("提醒文字1" "提醒文字2" "提醒文字3" ))")
  2. (defun alert1 (b1 / dd  dcl_id  i txt1)
  3. ; (alert1  '("提醒文字1" "提醒文字2" "提醒文字3"   "提醒文字4"  "注意事项1"  "注意事项2"))
  4.    (if (null tempname)   
  5.    (setq tempname (vl-filename-mktemp "tx11.dcl") )
  6.    )
  7.    (setq ff1 (open tempname "w") )
  8.    (write-line "tix11:dialog { label="飞龙在天,注意事项";"  ff1 )
  9.    (setq i 11)
  10.    (repeat (length b1)
  11.    (setq txt1 (strcat "  :text { label = "帮助提示内容";  key="t" (itoa i) ""; alignment =left;  }" ) )
  12.    (write-line txt1  ff1)
  13.    (setq i (+ i 1))
  14.    )
  15.    (write-line "      :edit_box{label = ":";key="ed11";edit_width=120;alignment = right;}"  ff1 )
  16.    (write-line "     ok_cancel; "  ff1 )
  17.    (write-line "    }"  ff1 )
  18.    (close ff1)   
  19. (if (> (setq dcl_id (load_dialog tempname )) 0);加载对话框
  20.    (progn
  21.       (new_dialog "tix11" dcl_id)
  22.       (setq i 0)
  23.          (repeat (length b1)
  24.          (setq txt1 (strcat "t" (itoa (+ 11 i))) )
  25.          (set_tile txt1 (strcat (itoa i) ":" (nth i b1)))
  26.          (setq i (1+ i))
  27.          )     
  28.       (action_tile "ok" "(done_dialog 1)");帮助提示内容      
  29.       (action_tile "cancel" "(done_dialog 0)");cancel        
  30.       (setq dd (start_dialog));返回特定回调对话框的数值

  31.      (UNLOAD_DIALOG DCL_ID)
  32.    )
  33.   (princ "\n Unable to load dialog box!");显示对话框失败
  34. )        
  35. )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2015-3-13 16:22:59 | 显示全部楼层
本帖最后由 自贡黄明儒 于 2015-3-13 16:27 编辑

(alert  "txt1\ntext2\ntext3")
(alert  "txt1\rtext2\ntext3")
(alert  "txt1\t text2\ntext3")
发表于 2015-3-14 13:32:06 | 显示全部楼层
自贡黄明儒 发表于 2015-3-13 16:22
(alert  "txt1\ntext2\ntext3")
(alert  "txt1\rtext2\ntext3")
(alert  "txt1\t text2\ntext3")

我也是这样写的。
发表于 2017-10-29 19:30:33 | 显示全部楼层
无法打开文件TX1101A.DCL是什么鬼
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-19 21:37 , Processed in 0.166577 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表