Home Tour! Products Download Purchase Support Company Contacts  

Question

Hi I am closing a Modal dialog box using Odcl_Form_Close, then using the AutoLisp 'command' function to activate the AutoCAD command chprop. The problem is that it will not activate the chprop command. What can I do?

Answer

What was happening was that you we calling the chprop command from the event defun that closes the dialog box. The problem is that the dialog box is truely not closed until the Odcl_Form_Show function is completed.

Example Error Code:

(defun c:test ()
(Odcl_LoadProject "testproject")
(Odcl_Form_Show testproject_dialogA)
)
(defun c:testproject_dialogA_button1_OnClicked()
(Odcl_Form_Close testproject_dialogA)
(if (Odcl_Form_IsActive testproject_dialogA)
(progn
(command "chprop" ...)
; do more stuff here
)
)
)

Corrected Example Code:

(defun c:test ()
(Odcl_LoadProject "testproject")
(setq buttonPressed Nil)
(Odcl_Form_Show testproject_dialogA)
(if (= buttonPressed "button1")
(if (Odcl_Form_IsActive testproject_dialogA)
(progn
(command "chprop" ...)
; do more stuff here
)
)
)
)

(defun c:testproject_dialogA_button1_OnClicked()
(setq buttonPressed "button1")
(Odcl_Form_Close testproject_dialogA)
)

)
Home Products Download Purchase Support Company Contacts