Name
Dialog.ShowModal -- open dialog and begin modal loop
Synopsis
retval = moai.DoMethod(id, "ShowModal")
Function
This method opens the dialog window and begins a modal loop that blocks the rest of the application and waits for the dialog to be closed before returning control to the script. In other words, Dialog.ShowModal will not return before the user either closes the dialog or the script calls Dialog.EndModal on the dialog, whatever happens first.

If you want to open a modeless dialog, i.e. a dialog that doesn't block your script while it is open, you must not use Dialog.ShowModal but set Window.Open to True for the dialog instead (and possibly set Application.Sleep to True too, if you wish to put the application in some sort of sleep state while the dialog is open). You can then implement the dialog's actual behaviour (e.g. a progress bar that is constantly being updated) by repeatedly calling a management function either using SetTimeout() or Hollywood 9.0's new RunCallback() function. When you're finished with a modeless dialog, just set Window.Open to False on it. Do not use Dialog.EndModal with modeless dialogs!

Note that it is good programming practice to create and destroy dialogs as needed. You should not keep them in memory for the complete lifetime of your application but only create them when necessary and destroy them as soon as you are finished with them. See Dialog class for details.

If you want to be notified when the user clicks the close box of a dialog, you have to install a listener on the Window.CloseRequest attribute. If there is no listener on this attribute, RapaGUI will simply call Dialog.EndModal with 0 as the parameter when the dialog's close box is clicked.

Inputs
id
id of the dialog object
Results
retval
dialog return value
Example
See moai.CreateObject


Show TOC