2023-04-24 17:12 UTC
I am trying to combine two modal dialogs.
Clicking on the TextButtons of the first modal dialog should close the current second modal dialog, if any, and open a new one with different options.
It does the task, but after a limited number of times, it closes de current second modal dialog but does not open the new one.
Here is the code, 'my_odcl_dir' should be substituted by the directory where you have downloaded 'FormTest.odcl'.
Clicking on the TextButtons of the first modal dialog should close the current second modal dialog, if any, and open a new one with different options.
It does the task, but after a limited number of times, it closes de current second modal dialog but does not open the new one.
Here is the code, 'my_odcl_dir' should be substituted by the directory where you have downloaded 'FormTest.odcl'.
(defun c:FormTest (/ g_form project)
(dcl_Project_Load (strcat my_odcl_dir "\\FormTest") T)
(dcl_form_show FormTest_Form1)
)
(defun c:FormTest/Form1#OnInitialize (/ TextButton11)
(setq
TextButton11 (mt_pmp_dlg "Close")
)
(dcl-Control-SetCaption FormTest/Form1/TextButton11 TextButton11)
(princ)
)
(defun mt_show_pict_form (form2show / form1_pos)
(setq
form1_pos (dcl-Control-GetPos "FormTest" "Form1")
)
(dcl-Form-Show "FormTest" form2show (car form1_pos) (+ (cadr form1_pos) (last form1_pos)))
)
(defun c:FormTest/Form1/TextButton0#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form02"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton1#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form06"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton2#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form02"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton3#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form04"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton4#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form04"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton5#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form03"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton6#OnClicked (/)
(if g_form
(dcl-Form-Close "FormTest" g_form)
)
(setq
g_form "Form05"
)
(mt_show_pict_form g_form)
)
(defun c:FormTest/Form1/TextButton11#OnClicked (/)
(if (and g_form (dcl-Form-IsActive "FormTest" g_form))
(dcl-Form-Close "FormTest" g_form)
)
(dcl-Form-Close FormTest/Form1)
)
(defun c:FormTest/Form02#OnInitialize ()
(dcl-Form-Enable FormTest/Form1 'T)
)
(defun c:FormTest/Form03#OnInitialize ()
(dcl-Form-Enable FormTest/Form1 'T)
)
(defun c:FormTest/Form04#OnInitialize ()
(dcl-Form-Enable FormTest/Form1 'T)
)
(defun c:FormTest/Form05#OnInitialize ()
(dcl-Form-Enable FormTest/Form1 'T)
)
(defun c:FormTest/Form06#OnInitialize ()
(dcl-Form-Enable FormTest/Form1 'T)
)
Any ideas why this happens?