User`s guide
9 Managing and Sh aring Application Data in GUIDE
You cannot close the Co lo r Pale tte and Tool P a lette windows by directly
clicking their close button (X).
In the next example, you set the output of Icon Editor to be the
CData of the
icon. The opening f unction for Icon Editor, with
uiwait, contains this code:
% in Icon E dito r
function gui de_i coneditor_OpeningFcn(hO bject, eventdata, . ..
handles, varar gin)
.
.
.
handles.colorPalette = guide_co lorpalette();
handles.toolPalette = guide_too lpalette('iconEditor', hObject);
.
.
.
% Update handles structure
guidata(hObject, handles);
uiwait(hObject);
As a result, you must call uiresume on each exit path:
% in Icon E dito r
function but tonO K_Callback(hObject, eventdata, handles)
uiresume(handles.figure);
function but tonC ancel_Callback(hObject, eventdata, handles)
% Make sure the return data will be empty if we cancelled
handles.mIconCData =[];
guidata(handles.figure, handles);
uiresume(handles.figure);
function Ico n Editor_CloseRequestFc n(hO bject, eventdata, h andles)
uiresume(hObject);
To ensure that the Color Palette is not closed any other w ay, override its
closerequestfcn to take no action:
% in colorPalette
9-42