Creating Graphical User Interfaces |
Modal Question Dialog
The modal question dialog template displayed in the Layout Editor is shown in the following figure.
Running the GUI displays the dialog shown in the following figure:
The GUI returns the text string Yes
or No
, depending on which button you press. The GUI is blocking, which means that the current M-file stops executing until the GUI restores execution. You can make a GUI blocking by adding the following command to the opening function:
To restore access to other MATLAB windows once a button is pressed, add the following command to callbacks for both the Yes and No push buttons:
The GUI is also modal, which means that the user cannot interact with other MATLAB windows until clicking one of the buttons. See Using Modal Figure Windows for more information on making a GUI modal.
Select this template if you want your GUI to return a string or to be modal.
See Example: Using the Modal Dialog to Confirm an Operation for an example of using this template with another GUI.
GUI with Axes and Menu | Example: Using the Modal Dialog to Confirm an Operation |