unwanted program-exit with form-show

Started by Peter2, March 31, 2017, 03:41:48 AM

Previous topic - Next topic

Peter2

I have a modal form where I have this basic structure:

Code (autolisp) Select
(defun c: main ()

.. prepare something  ..

(setq result 10)
(while (> result 10)
     (dcl-form-show ...)
)
); end defun

Via Events from the opened dialog I start others functions

(defun c:ondblclick ()
    (close form)
    (calculate something)
    (show form)
)


Now the result is:
- the first call shows the dialog
- the doubleclick shows the dialogue for 1 ms and the closes it -> "result" is set to 2

I tried to track the error and thought that "show-form" is directly followed by "oninitialize". I suggest that in my oninitialize-code is the error, and I tried
Code (autolisp) Select
(defun c:oninitialize ()
(alert "hello")
do something
..
)


I thought that the "alert" will show me that "onini" is just starting, but the dialogue is closed before the alert.

So:
a) What could be the reason?
b) What happens between "show form" and "oninitialize"?

Thanks and regards

Peter

EDIT:
In the meantime I changed to "modeless" dialogue, and there it works.
But nevertheless - should it work in "Modal" too?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10