Home Tour! Products Download Purchase Support Company Contacts  

Question

I have a series of dialog boxes and after I activate a few of them, one from another, from another, etc. The dialog boxes will no longer close after several have been activated, why?

Answer

The problem is caused by the (odcl_form_show ...) function being called from within the event defun of the buttons of each dialog box, just after (odcl_form_close ...) is called. The solution is to call the (odcl_form_show ...) in the defun that activates the previous dialog box.

The problem is caused by the fact that when (odcl_form_close ...) is called, the dialog box is not truely destroyed from memory until the (odcl_form_show ...) call is completed in the defun last calling it.

Problem Example AutoLisp Code:

(defun c:test ()
(Odcl_Form_Show diatest_DclForm1)
)

(defun c:DclForm1_OK_OnClicked ()
(Odcl_Form_Close diatest_DclForm1)
(Odcl_Form_Show diatest_DclForm2)
)


(defun c:DclForm2_OK_OnClicked ()
(Odcl_Form_Close diatest_DclForm2)
(Odcl_Form_Show diatest_DclForm1)
)

Corrected AutoLisp Code:

To correct the problem a loop was used in this case to keep track of what dialog box to display next. A global variable was used to identify which dialog box to display next.

(defun c:test ()
(setq nextDlg 1)

(while (/= nextDlg Nil)
(if (= nextDlg 1)
(progn
(setq nextDlg Nil)
(Odcl_Form_Show diatest_DclForm1)
)
)
(if (= nextDlg 2)
(progn
(setq nextDlg nil)
(Odcl_Form_Show diatest_DclForm2)
)
)
)
)

(defun c:DclForm1_OK_OnClicked ()
(Odcl_Form_Close diatest_DclForm1)
(setq nextDlg 2)
)

(defun c:DclForm2_OK_OnClicked ()
(Odcl_Form_Close diatest_DclForm2)
(setq nextDlg 1)
)
Home Products Download Purchase Support Company Contacts