OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: borsa on December 22, 2011, 02:12:30 AM

Title: Re-open a modal dialog
Post by: borsa on December 22, 2011, 02:12:30 AM
Hello Again, I am trying to open, close, and open again a Modal dialogs

I have two dialogs :
Form1 with a button to close itself and open Form2
Form2 with a button to close itself and open Form1

From form1 to form2 the program is ok but from form2 to form1 the program close form2 as cancell (return 2) and don`t open form1.

I've atached the lisp and odcl files to test them if you want.

Whas is wrong?

thanks for your help.
Title: Re: Re-open a modal dialog
Post by: Fred Tomke on December 22, 2011, 03:14:40 AM
Hi,

make it as written in the FAQ (http://www.opendcl.com/forum/index.php?topic=1080.0): there I've shown how to get access to AutoCAD after closing a form. It is similar to your question: make an outer while-loop and an inner while-loop for your forms. Make sure that you've complete left the event functions which closes the form before showing the next (don't leave the car before stopping it).

A simple sample:

Code (autolisp) Select
(defun c:mycommand ()
  (defun c:form1ok ()
    (dcl_form_close form1 1)
  ); c:form1ok

  (defun c:form2ok ()
    (dcl_form_close form2 1)
  ); c:form2ok

  (while (and (= (dcl_form_show form1) 1)  (= (dcl_form_show form2) 1))
); c:mycommand


Regards, Fred
Title: Re: Re-open a modal dialog
Post by: borsa on January 10, 2012, 02:32:12 AM
Hello

To fix the question i did it a while-loop as in the file attached and works prefectly.

thanks for your help