Declared in WCDialogBox.h
Opens a simple dialog box with 1-4 response options to select from.
Base class: MFrame
|MDialogBox(parent,rect,title,text,answer0,answer1,answer2,answer3)||Standard-form constructor. Creates a new dialog box window and calls init.|
|init(title,text,answer0,answer1,answer2,answer3)||Creates dialog buttons and arranges them.|
|button(i)||Returns the specified dialog button.|
|getResult()||Returns the index of the selected response (0, 1, 2 or 3) or -1 if there was no response.|
Redirect focus to the first button.
Change response on Left/Right arrow or Tab/Shift+Tab keys, close on unpush of Esc/Enter (even if originates in a descendant).
Set response using button notices and close the dialog.
Rearrange dialog buttons.
In Elgrint, there is nothing special about dialogs - they are just windows like all others. MDialogBox is normally used in conjunction with runMessageLoop, so that the selection result is determined "on the spot" (this is sometimes called "modal dialog"). MDialogBox is a relatively simple selector, even though it's derived from a complex MFrame container. Its selection result is the index of the button that was selected by the user, based on the textual information displayed above the buttons. The buttons themselves also contain short textual description of the choices, associated with each button. The user can click the desired button, or use Left/Right arrow keys or Tab/Shift+Tab and Enter to select one. When the selection is made, the dialog box closes, and the getResult function returns the 0-based index of the selected button (from the left). If the dialog is closed without any selection (user clicked the frame's "close" button, or pressed Alt+F4 or Esc), getResult returns -1.
The button function can be used to customize the buttons (colors, location, graphical content, etc).
- This class supports the RTL property just like its base class MFrame
- The dialog buttons are children of the MFrame itself, not of its bar, even though they appear over the bar
- Even though MDialogBox is classified as a selector, it does not generate selection notices. However, it can be used as a base class for a different dialog, which can generate notices
- It is not recommended to use MDialogBox to display serious error messages (in particular, when replacing MHandleException function), because it may not work properly during some errors. Use MApp::messageBox instead
Let us know
Please Contact us to report any errors on this page, or to suggest any improvements.