| Creating Graphical User Interfaces | ![]() |
Defining the Yes and No Buttons Callbacks
The callbacks for the Yes and No buttons perform the same basic steps:
handles structure answer field.guidata to save the modified handles structure, which is then read by the main function.uiresume to continue the blocked code in the main function.The Tag property of each push button uicontrol was changed before saving the application M-file so that the callback function names are more descriptive. The following code illustrates the implementation of the callbacks.
function varargout = noButton_Callback(h, eventdata, handles, varargin) handles.answer = 'no'; guidata(h, handles); uiresume(handles.figure1);
function varargout = yesButton_Callback(h, eventdata, handles, varargin) handles.answer = 'yes'; guidata(h,handles); uiresume(handles.figure1);
| Executing a Callback | Protecting the GUI with a Close Request Function | ![]() |