Specifications

5 Application Examples
5-16
uiresume(handles.figure1);
function varargout = yesButton_Callback(h, eventdata, handles, varargin)
handles.answer = 'yes';
guidata(h,handles);
uiresume(handles.figure1);
Protecting the GUI with a Close Request Function
Whenever a user closes a figure, MATLAB first executes the figure’s close
request function, as defined by the
CloseRequestFcn figure property. The
default close request function simply deletes the figure. However, a GUI may
want to protect the user from unintentionally deleting a figure if they click on
the
X in the close box of the window border.You can change the default close
request function by redefining the figure’s
CloseRequesFcn.
The “The Close Button Callback” section shows a callback for the GUI’s
Close
button that you could also use as a close request function. To add the new close
request function to your application M-file, select the figure in the Layout
Editor and right click to display the context menu.