Author Topic: dcl_form_close problem  (Read 521 times)

potencjalek

  • Member
  • *
  • Posts: 25
dcl_form_close problem
« 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?


owenwengerd

  • Administrator
  • Hero Member
  • *****
  • Posts: 3018
    • Outside The Box
Re: dcl_form_close problem
« Reply #1 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).

potencjalek

  • Member
  • *
  • Posts: 25
Re: dcl_form_close problem
« Reply #2 on: January 29, 2020, 10:14:02 PM »
thanks Owen
understood - actually I was expecting this kind of answer.
I already changed my code.