dcl_form_close problem

Started by potencjalek, January 26, 2020, 05:29:04 AM

Previous topic - Next topic

potencjalek

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?


owenwengerd

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).
Owen Wengerd (Outside The Box) / ManuSoft

potencjalek

thanks Owen
understood - actually I was expecting this kind of answer.
I already changed my code.