This class is an implementation of a modal dialog. This means that the dialog grabs control, and waits for the user to select an appropriate command from the dialog. You can use any of the methods defined by the vDialog class, as well as the new ShowModalDialog method.
There are two versions of the constructor, one for constructing dialogs from windows, the other from the vApp object. See the description of the vDialog constructor for more details.
The default value for the title is an empty string, so you can declare instances of modal dialogs without the title string if you wish. The dialog title will always show in Windows, but in X is dependent on how the window manager treats decorations on transient windows.
Please see the description of DialogDisplayed for an important discussion of setting dialog control values.
There are a couple of ways to close a modal dialog and make ShowModalDialog return, all controlled by the DialogCommand method. The default DialogCommand will close the modal dialog automatically when the user clicks the M_Cancel, M_Done, or M_OK buttons.
All command actions are still passed to the virtual DialogCommand method, which is usually overridden in the derived class. By first calling vModalDialog::DialogCommand to handle the default operation, and then checking for the other buttons that should close the dialog, you can also close the dialog by calling the CloseDialog method, which will cause the return.
The following code demonstrates this.
void myModal::DialogCommand(ItemVal id, ItemVal val,
CmdType ctype)
{
// Call the parent for default processing
vModalDialog::DialogCommand(id,val,ctype);
if (id == M_Yes || id == M_No) // These close, too.
CloseDialog();
}