How to close "WAIT-FOR THIS-OBJECT:ShowDialog()" p

Posted by Karikalan Ram on 05-Jan-2016 10:53

Hi All,

I display modal dialog message window using WAIT-FOR THIS-OBJECT:ShowDialog(). However I dont want user to manualy to close this window by Close the form by clicking on the X button. I want to close this programmatically. I have tried using myDlgForm: Close () but control does not comes to this stage to execute since Wait-for block the ctrl. Could you please suggest on this?

For example, I generate the report and display the status message 'In-Progress' in modal mode using ShowDialog() when the report generation process complete this message window should disappear without any user intraction and display the report output. At this moment, we have to close this 'In-progress' dialog window since we are calling using ShowDialog(). Also code syntax forces to use 'Wait-For'. i.e. WAIT-FOR THIS-OBJECT:ShowDialog(). 

Thanks.

Kalan

Posted by Karikalan Ram on 06-Jan-2016 07:50

Thanks Laura,

At this moment we're using Show method -issue raised here by user when they switch into other application like outlook show window stays behind application and user can play or navigate to other docks in the same application. That's the main reason we preferred to use dialog modal mode. However, now I have managed this with the work around by changing the cursor status using "SET-WAIT-STATE " as it blocks user and system input.

Cheers.

All Replies

Posted by Laura Stern on 05-Jan-2016 11:05

So it sounds like this is a .NET form.  You can indeed use myDlgForm:Close().  I don't understand when you say "control does not comes to this stage to execute since Wait-for block the ctrl."  Obviously you need to call Close() when the report generation process is complete.  The question is - how is the report running at the same time that the dialog is being displayed.  Is it running async on an AppServer?  Is it run by hitting a button on the dialog?  If it is async, you would call Close() in your PROCEDURE-COMPLETE event procedure.  If it is just something that happens synchronously based on a button click, you run whatever code you need to generate the report and then you call Close() when that returns.  So how are you not getting control?

Posted by Karikalan Ram on 05-Jan-2016 11:44

Hi Laura,

Thanks for your reply. Yes, its .Net form from ABL. It runs synchronously by clicking the button, Before run the report generation procedure invokes message window at dialog mode(i.e.  WAIT-FOR MessFrm:ShowDialog().) At end of report generation routine, I have called the method MessFrm:Close(). However, program control doesn't pass Wait-For statement to proceed with report generation routine, if we manually close message window by clicking 'X' then control proceed to run report generation routine. Not sure if I need to use 'Process Events' OR I need to run another program simultaneously to trigger MessFrm:Close()? Please suggest.  - Thanks again.

Posted by Laura Stern on 05-Jan-2016 12:57

It sounds like you click a button that is NOT on the dialog.  It gets to your event handler and you are about to generate the report, but first you show the dialog.  And then you're stuck because you can't do anything else - even run the report.  So clearly you cannot close the dialog when the report is done since it never happens in the first place!  Is that what you're saying?

Is the dialog some kind of status window for the report generation?  I presume you made it modal because you don't want anything else happening in the app at the same time?  

If this is the scenario, you're right - it doesn't work, and I don't know how to make it work either.  I think you need to just use Show() rather than ShowDialog on the this in-progress Form and prevent handling of any other events in a different way.  For example, maybe you can set the Enabled property on other forms/controls to false while the report is being generated.

Posted by Karikalan Ram on 06-Jan-2016 07:48

Thanks Laura,

Now I have managed this with the work around by changing the cursor status using "SET-WAIT-STATE " as it blocks user and system input.

Cheers.

Posted by Karikalan Ram on 06-Jan-2016 07:50

Thanks Laura,

At this moment we're using Show method -issue raised here by user when they switch into other application like outlook show window stays behind application and user can play or navigate to other docks in the same application. That's the main reason we preferred to use dialog modal mode. However, now I have managed this with the work around by changing the cursor status using "SET-WAIT-STATE " as it blocks user and system input.

Cheers.

This thread is closed