dialog boxes and dynamic menus.

Emma

Member
When i run a dialog box from a dynamic menu, and then close it down, the main program thinks that any .p or .w the dialog box has run are still being run, as well as the dialog box. To get round the problem of the dialog box i added DELETE PROCEDURE THIS-PROCEDURE to the window-close trigger. this appears to work, but there are still rouge programs running.

E.g One dialog box has a wrapper to pass in the parameters it needs. The dialog box closes successfully, but the main program still thinks the wrapper is running, and so will not run the dialog box again.

Does anyone have any ideas? Does anyone understand what i am waffling on about??

Please help.

Emma. :blue:
 
'...but the main program still thinks the wrapper is running, and so will not run the dialog box again.'

It's not that you can't run a dialog-box procedure more than once. It's likely that the dialog-box is run from a trigger, and triggers can't be called recursively. So when a trigger is active (running) it will not fire again until the trigger code is complete. When you run a dialog-box, it always contains its own WAIT-FOR statement in the MAIN-BLOCK and this stops it returning to the trigger so that the trigger code can complete.

If the procedure isn't ending properly, it usually means that the event attached to the WAIT-FOR hasn't occurred yet OR that a WAIT-FOR on a child procedure hasn't occurred yet.

Executing 'DELETE PROCEDURE THIS-PROCEDURE' does not cause the WAIT-FOR to terminate, but it does clear out almost all other resources. So when the WAIT-FOR really does end, you would usually see an error saying that the widget associated with the WAIT-FOR is no longer valid.

So to close the dialog-box correctly, you should simply need to fire the event attached to the WAIT-FOR, or the undo events of the DO block that usually contains the WAIT-FOR.

BUT, if the dialog procedure has executed say another procedure that issues another WAIT-FOR, then the first procedure will not end until its sub-procedures have ended. So if you find the dialog doesn't terminate properly, it can mean that some other child procedure hasn't been closed. If you are using SmartObjects, for example, you need to ensure that all objects terminate properly when the containing dialog is closed.
 
Top