User`s guide

Making Multiple GUIs Work Together
uiresume(handles.figure);
function fig ure_ CloseRequestFcn(hObject , ...
eventdata, ha ndle s)
uiresume(hObject);
Applying the Text Change
Use the reference to the main GUI in the handles structure saved by
OpeningFcn in the modal dialog box to apply the text change. The u ser clicks
OK to apply the text change. This sets the Change Me button label in the
main GUI to the value entered in the text field of the modal dialog box.
function button OK_C allback(hObject, .. .
eventdata, ha ndle s)
text = get(handles.editChangeMe , 'String');
main = handles.changeMeMain;
mainHandles = guidata(main);
changeMeButton = mainHandles.buttonChangeMe;
set(changeMeButton, 'String', t ext);
uiresume(handles.figure);
Closing the Main GUI
When the user closes the changeme_di alog GUI, the changeme_main GU I is
in a waiting state. The user can either click the push button to change the
name again or close the GUI by clicking the X close box. When the user closes
the GUI, its
OutputFcn returns the push button’s current label (its String
property) before deleting the GUI figure:
function vararg out = changeme_dialog_Dialog_OutputFcn...
(hObject, ev entd ata, handles)
% Get pushbutton string fro m handles structure and output it
varargout{1} = get(handles.buttonChangeMe,'String');
% Now destroy yourself
delete(hObject);
You also need a CloseRequest Fcn. If you do not specify one, the GUI cannot
output data because the default
CloseRequestFcn, the MATLAB function
closreq, imm ed iately deletes the figure before any O utpu tFcn can be called.
This
figure_CloseRequestFcn does that, but only if the GUI is not in a
9-29