取得與設定DCL對話框的位置
本帖最后由 pizg 于 2011-3-3 18:16 编辑請問如何取得與設定DCL對話框的位置? 对话框开始的位置可通过new_dailog函数进行指定。但如何取得就不知道了。
(new_dialog dlgname dcl_id ]) 回复 ZZXXQQ 的帖子
我清楚..你說的這語法在說明文件裏,
但你能不能舉個實例?
謝謝. 頂一下~
有請各位大師解答 // DCL File to be saved as test.dcl
// Example courtesy of Lee Mac © 2011
test : dialog { label = "Test Dialog";
spacer;
: text { label = "Move me"; alignment = centered; }
spacer;
: button { key = "accept"; is_default = true; label = "I'm Done"; }
}
(defun c:test ( / *error* dcl dch )
;; Demonstrates how to remember a dialog screen
;; position for next use.
;; Requires accompanying file: test.dcl to be
;; saved in an AutoCAD Support Path.
;; Error Handler so that we may unload the dialog
;; from memory should the user hit Esc.
(defun *error* ( msg )
(if dch (unload_dialog dch))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)
;; Plentiful Error trapping to make sure
;; dialog is loaded successfully.
(cond
(
(not
(and
(setq dcl (findfile "test.dcl")) ;; Check for DCL file
(< 0 (setq dch (load_dialog dcl)));; Attempt to load it if found
)
)
;; Else dialog is either not found or couldn't be loaded:
(princ "\n** DCL File not found **")
)
(
(not (new_dialog "test" dch "" (cond ( *screenpoint* ) ( '(-1 -1) ))))
;; If our global variable *screenpoint* has a value it will be
;; used to position the dialog, else the default (-1 -1) will be
;; used to center the dialog on screen.
;; Should the dialog definition not exist, we unload the dialog
;; file from memory and inform the user:
(setq dch (unload_dialog dch))
(princ "\n** Dialog could not be Loaded **")
)
(t
;; Dialog loaded successfully, now we define the action_tile
;; statements:
(action_tile "accept" "(setq *screenpoint* (done_dialog 1))")
;; The dialog screen position is returned by the done_dialog
;; function, so we store this in our global variable *screenpoint*
;; for next time.
(start_dialog)
;; Display the dialog - we can use the return of start_dialog
;; to determine whether the user pressed OK or Cancel.
(setq dch (unload_dialog dch))
;; We're done, unload the Dialog from memory.
)
)
(princ) ;; Exit Quietly...
)
回复 sachindkini 的帖子
感謝sachindkini 您的正確解答 谢谢,呵呵,我又学到一点了 非常感谢,解决了我的传为难题! 找了好久,测试正常,谢谢
页:
[1]