User`s guide

15 Examples of GUIs Created Programmatically
3 Click here to display the GUI code file in the Editor (read-only).
Note Do n o t save GUI files to the examples folder where you fo und them,
or you will overwrite the original files. Save them to your current or other
folder that you work in.
Subfunction Summary for Color Palette
The color palette example includes the callbacks listed in the following table.
Function Description
colorCellCallback
Called by hPalettePanelSe lect ionChanged when any
color cell is clicked.
eraserToolCallback
Called by hPalettePa nelS electionChanged when the
Eraser button is clicked.
hMoreColorButtonCallback
Executes when the More Colors button is clicked. It calls
uisetcolor to open the standard color-selection dialog
box, and calls
localUpdateColor to update the preview.
hPalettePanelSelectionChanged
Executes when the GUI user clicks on a new color. This
is the
SectionChangeFcn callback of the ui buttongroup
that exclusively manages the tools and color cells that it
contains. It calls the appropriate callback to service each
of the tools and color cells.
Note Three e vent data fields are defined for use with button groups
(
uibuttongroup). These fields enable you to determine the previous and
current radio or toggle button selections maintained by the button group.
See
SelectionChangeFcn in the Uibuttongroup Properties reference page
for more information.
15-56