Creating Graphical User Interfaces Previous page   Next Page

Modal Question Dialog

The modal question dialog template displayed in the Layout Editor is shown in the following figure.

modal question dialog template

Running the GUI displays the dialog shown in the following figure:

question dialog

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 clicked, 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.


Previous page  GUI with Axes and Menu Using the Layout Editor Next page

© 1994-2005 The MathWorks, Inc.