OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: potencjalek on January 26, 2020, 05:29:04 AM

Title: dcl_form_close problem
Post by: potencjalek on January 26, 2020, 05:29:04 AM
I use dcl_form_close of modal dialog with an argument
(dcl_form_close Test_TestForm 5)
as a return value for form_show function,
everything works fine, but I noticed that when I invoke that method inside of the function Grid2#OnMouseDown (it could be in any grid) then dcl_form_close always return 2, instead of argument.

Did anyone notice that?
Maybe I do something wrong but I investigated a lot and I'm 99% sure that this is happening only when (dcl_form_close Test_TestForm 5) is invoked inside of the OnMouseDown function.
Can anyone help?

Title: Re: dcl_form_close problem
Post by: owenwengerd on January 26, 2020, 06:46:56 PM
A modal form does not close during (dcl-Form-Close), but after the function returned and the form finishes processing all the Windows messages for the form. In the meantime, some other event (either your own or a Windows message handler) can supersede your exit code. For instance, your mouse down event is likely followed by a mouse-up event. That event handler or message handler might be superseding your exit code (for instance, if the mouse-up occurs over the cancel button, which is always return code 2).
Title: Re: dcl_form_close problem
Post by: potencjalek on January 29, 2020, 10:14:02 PM
thanks Owen
understood - actually I was expecting this kind of answer.
I already changed my code.