russell84 发表于 2022-7-5 17:33:42

是否消息

有人知道lisp中创建带有“是”和“否”按钮的警告消息的代码吗?如果是,一个功能正常,如果不是,另一个功能正常吗???
 
提前感谢

Kerry Brown 发表于 2022-7-5 17:40:00

 
如果你是一个随意的客户,看看DosLib
http://download.mcneel.com/download.asp?id=doslib
 
 
(dos\u msgbox文本标题按钮图标[持续时间])
 
有关示例代码,请参阅帮助文件。。。
 
 
如果你想推出自己的产品,不妨看看OpenDCL
http://opendcl.com/wordpress/
https://sourceforge.net/project/showfiles.php?group_id=187950
 
 
... 或者你可以使用标准的DCL,我记得看到过几个YesNo类型DCL对话框的例子。

Kerry Brown 发表于 2022-7-5 17:40:45

.. 或者,如果已加载express tools,请尝试以下操作。。


(SETQ reply (ACET-UI-MESSAGE "Choose dude "
                           "Russells Dialog"
                           (+ Acet:YESNOCANCEL Acet:ICONWARNING)
            )
)
;; Yes = 6
;; No = 7
;; Cancel = 2
(IF (= reply 6)
(PROGN (ALERT "Yep")
      ;;
      ;; More Yes Mojo
)
;; else
(PROGN (ALERT "Nope")
      ;;
      ;; More no mojo
)
)


Kerry Brown 发表于 2022-7-5 17:43:55

或者这个可能更适合你


(SETQ reply (ACET-UI-MESSAGE "Choose dude "
                           "Russells Dialog"
                           (+ Acet:YESNO Acet:ICONQuestion)
            )
)

russell84 发表于 2022-7-5 17:46:51

啊哇-很好,做出适当的回应-亲爱的伙计!!!哈哈哈
 
这真的很好-谢谢你-我知道如何在DCL中完成,但我不想经历加载DCL并为这个lisp创建另一个关联文件的过程。
 
再次感谢-是的,我有快递

CAB 发表于 2022-7-5 17:52:14

这将为您创建DCL。
;; YesNo.lsp CAB 04.260.2008
;;Creates a DCL file on the fly for Yes/No Prompt
;; Arguments:
;;   BoxTitle = Dialog Box Title
;;   Question = Question to be displayed
;; Sample Call (YesNo " My Yes No" "Do you like creating programs in AutoLISP?")
;;Returns "Yes" or "No" from user or nil if the DCL failed

(defun YesNo (BoxTitle Question / Dcl_Id% Result acadfn fn fid)
(if
   (and (or (setq fn (findfile "YesNo.dcl"))
            (setq acadfn (findfile "ACAD.PAT")
                  fn   (strcat (substr acadfn 1 (- (strlen acadfn) ) "YesNo.dcl")))
      (setq fid (open fn "w"))
   )
    ;; create dcl file in same directory as ACAD.PAT
    (progn
      (foreach x
               (list
               "YesNo : dialog { key = \"Title\";"
               "spacer;"
               (strcat ": text { key = \"Question\" ; width = "
                         (itoa (+ (strlen Question) 4))
                         " ; alignment = centered; }")
               "spacer;"
               ": row { fixed_width = true; alignment = centered;"
               "    : button { key = \"Yes\"; label = \"&Yes\"; is_default = true;}"
               "    : button { key = \"No\"; label = \"&No\"; is_cancel = true;}"
               "}"
               "}"
               )
      (princ x fid)
      (write-line "" fid)
      )
      (close fid)
    )
)
(cond
   ((setq Dcl_Id% (load_dialog fn))
    (new_dialog "YesNo" Dcl_Id%)
    (set_tile "Title" BoxTitle)
    (set_tile "Question" Question)
    (action_tile "Yes" "(done_dialog 1)")
    (action_tile "No" "(done_dialog 0)")
    (setq Result (start_dialog))
    (unload_dialog Dcl_Id%) ; Unload Dialog
    (if (and Result (= Result 1)) "Yes" "No")
   )
   (t nil)
)
)

russell84 发表于 2022-7-5 17:55:11

可以使用lisp在DCL中创建对话框。
 
哇,我不知道-谢谢你
 
这很好,因为这样我就不必依赖于lisp有2个文件。
 
我会经常用它
 
非常感谢。

fuccaro 发表于 2022-7-5 17:56:59

驾驶室
你当地的星号是多少?
不要介意!嫉妒使我邪恶

CAB 发表于 2022-7-5 17:59:33

你会认为在打字时看一下键可以消除这些错误。错误的

wishbonesr 发表于 2022-7-5 18:03:11

我通常不会为此编写循环,但这是我在vlide中设计对话框后使用的公式。
我将文本复制到excel中。
注意:如果我在dcl格式中使用制表符,我必须导入文本并选择忽略制表符。
 
然后在B列中,或者在任何地方。。。
=“(写入行”“”&报告(“\t”,LEN(A1)-LEN(替换(A1,CHAR(9),”“))&替换(替换(A1,CHAR(9),”“),”“”“,”“,”“\”“”)和“dclf)”
 
将公式复制到其余行,并将输出复制回函数中的vlide。
dclf是dcl文件,下面的示例在CAB的示例中使用var fn。
页: [1] 2
查看完整版本: 是否消息