User`s guide

Icon Editor
Share Data Between Two GUIs
The iconEditor embeds a GUI, the colorPalette, to enable the user to select
colors for the icon cells. The colorPalette returns the selected color to the
iconEditor via a function handle.
The colorPalette GUI. Like the iconEditor, the colorPalette defines a cell
array,
mOutputArgs, to hold its output arguments.
mOutputArgs = {}; % Variable for storing output when GUI returns
Just before returning, colorPalette assigns mOutputArgs the function
handle for its
getSelectedColor helper function and then assigns
mOutputArgs to varargout to return the arguments.
% Return user defined output i f it is requested
mOutputArgs{1} =@getSelectedColor;
if nargout>0
[varargout{1:nargout}] = mOutputAr gs{:};
end
The iconEditor e xecutes the colorPalette’s getSeclectedColor function
whenever it invokes the function that colorPalette returns to it.
function color = getSelectedColor
% function returns the curr ently selected colo r in this
% colorPlatt e
color = mSelectedColor;
The iconEditor GUI. The iconEditor function calls colorPalette only once
and specifies its parent to be a panel in the iconEditor.
% Host the ColorPalette in the PaletteContainer a nd keep the
% function handle for getti ng its selected col or for editing
% icon.
mGetColorFcn = colorPalette('parent', hPaletteContainer);
This call creates the colorPalette as a com ponent of the iconEditor and then
returns a function handle that
iconEditor can call to get the currently
selected color.
15-77