User`s guide

Icon Editor
Run a GUI on Multiple Platforms
The prepareLayout utility function s ets various properties of all the GUI
components to enable the GUI to retain the correct look and feel on multiple
platforms. Code in the initialization section of iconEditor calls
prepareLayout
withthehandleofthemainfigure.
% Make changes needed for prop er look and feel and running on
% different platforms
prepareLayout(hMainFigure);
First, p repareLayout uses findall to retrieve the handles of all o bjects
contained in the figure. The list of retrieved handles also includes the
colorPalette,whichisembeddedintheiconEditor, and its children. The
figure’s handle is passed to
findall as the input argument topContainer.
function prepar eLay out(topContainer)
...
allObjects = findall(topContainer);
Background Color. T he default component background color is the standard
system background color on w hich the GUI is running. This color varies on
different computer systems, e.g., the standard shade of gray on the PC differs
from that on UNIX system , and may not match the default GUI background
color.
The
prepareLayout function sets the background color of the GUI to be the
same as the default component background color. This provides a consistent
look w ithin the GUI, as well as with other application GUIs.
It first retrieves the default component background color from the root object.
Then sets the GUI background color using the figure’s
Color property.
defaultColor = get(0,'defaultuicontrolbackgroundcolor');
if isa(handl e(to pContainer),'figure')
...
% Make figure color match that of GUI objects
set(topContainer, 'Color',defaultColor );
end
15-75