Reference » Window classes » MDialogBox

Elgrint::MDialogBox class

Declared in WCDialogBox.h


Opens a simple dialog box with 1-4 response options to select from.


Base class: MFrame


Name Description
MDialogBox(parent,rect,title,text,answer0,answer1,answer2,answer3) Standard-form constructor. Creates a new dialog box window and calls init.


Name Description
init(title,text,answer0,answer1,answer2,answer3) Creates dialog buttons and arranges them.


Name Description
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.


Name Description

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).


  • Propagation of Esc and Enter is blocked so that their possible handling in ancestors won't interfere with the unpush events of these keys


Set response using button notices and close the dialog.


Auto-size, auto-pos.


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).



Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.