Specifications
4 Programming GUIs
4-44
Clicking the Yes button closes both the close dialog and the GUI that calls it.
Clicking the
No button closes just the dialog.
How the GUI and Dialog Work
This section describes what occurs when you click the Close button on the GUI:
1 User clicks the Close button. Its callback then
- Gets the current position of the GUI from the
handles structure with the
command
pos_size = get(handles.figure1,'Position')
- Calls the modal dialog with the command
user_response = modaldlg('Title','Confirm Close');
This is an example of calling a GUI with a property value pair. In this case,
the figure property is
'Title', and its value is the string 'Confirm
Close'
. Opening modaldlg with this syntax displays the text “Confirm
Close” at the top of the dialog. See “Input and Output Arguments” on
page 4-7 for more information about the options for calling a GUI.
2 The modal dialog opens with the 'Position' obtained from the GUI that
calls it.
3 The opening function in the modal dialog M-file:
- Makes the dialog modal.
- Executes the
uiwait command, which causes the dialog to wait for the
user to click the
Yes button or the No button, or click the close box (X) on
the window border.