fl202 发表于 2015-3-13 16:10:07

通用函数- 提醒警告对话框

本帖最后由 fl202 于 2015-3-13 16:20 编辑

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

   (UNLOAD_DIALOG DCL_ID)
   )
(princ "\n Unable to load dialog box!");显示对话框失败
)      
)

自贡黄明儒 发表于 2015-3-13 16:22:59

本帖最后由 自贡黄明儒 于 2015-3-13 16:27 编辑

(alert"txt1\ntext2\ntext3")
(alert"txt1\rtext2\ntext3")
(alert"txt1\t text2\ntext3")

sicky111 发表于 2015-3-14 13:32:06

自贡黄明儒 发表于 2015-3-13 16:22 static/image/common/back.gif
(alert"txt1\ntext2\ntext3")
(alert"txt1\rtext2\ntext3")
(alert"txt1\t text2\ntext3")

我也是这样写的。

lifuq1979 发表于 2017-10-29 19:30:33

无法打开文件TX1101A.DCL是什么鬼
页: [1]
查看完整版本: 通用函数- 提醒警告对话框