LosGirk 发表于 2022-7-5 22:38:37

新款Mad Max预告片外观

大家好,
希望有人能帮我回答一个问题。这些代码段之间有什么区别?对话框1和设置userclick T是否完成了相同的操作?
 
(action_tile "accept" "(done_dialog 1)")
(setq Return# (start_dialog))

 

 
(done_dialog)(setq userclick T)

 
我知道返回#与有多个带有next和back按钮的对话框有关,但是ddiag1和userclick T我遇到了问题。
 
 
谢谢你的时间,祝你度过一个不平凡的星期天!

Tharwat 发表于 2022-7-5 23:05:18

完全没有区别,这都是关于程序员走哪条路的问题。
 
卸载对话框后,必须有以下内容。
 
e、 g编号:(1)


(if (and Return# (eq Return# 1))
(progn
   .....
   )
)
例如No:(2)
 

(if userclick1
(progn
   .....
   )
)

Lee Mac 发表于 2022-7-5 23:20:56

 
它们基本上导致相同的对话行为;但请注意,这两个表达式都不是必需的,因为accept和cancel互动程序的操作语句是预定义的,done\u对话框返回值分别为1和0。
 
考虑以下快速示例来验证这一点:
(defun c:dcltest ( / *error* dch dcl des )

   (defun *error* ( msg )
       (if (< 0 dch) (unload_dialog dch))
       (if (= 'file (type des)) (close des))
       (if (and (= 'str (type dcl)) (setq dcl (findfile dcl))) (vl-file-delete dcl))
       (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
         (princ (strcat "\nError: " msg))
       )
       (princ)
   )

   (if (and (setq dcl (vl-filename-mktemp nil nil ".dcl"))
            (setq des (open dcl "w"))
            (write-line "test:dialog{label=\"DCL Test\";spacer;ok_cancel;}" des)
            (not (setq des (close des)))
            (< 0 (setq dch (load_dialog dcl)))
            (new_dialog "test" dch)
       )
       (if (= 1 (start_dialog))
         (princ "\nUser pressed OK.")
         (princ "\nUser pressed Cancel.")
       )
   )
   (*error* nil)
   (princ)
)

LosGirk 发表于 2022-7-5 23:35:09

谢谢你们,你们太棒了。帮我渡过难关!

Tharwat 发表于 2022-7-5 23:53:40

 
祝你好运
页: [1]
查看完整版本: 新款Mad Max预告片外观