
Color Palette
12-27
Note Three eventdata 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 for more information.
The example also includes the helper functions listed in the following table.
M-File Structure
The colorPalette is programmed using nested functions. Its M-file is organized
in the following sequence:
1 Comments displayed in response to the help command.
Function Description
layoutComponent
Dynamically creates the Eraser tool and the color
cells in the palette. It calls
localDefineLayout.
localUpdateColor
Updates the preview of the selected color.
getSelectedColor
Returns the currently selected color which is then
returned to the
colorPalette caller.
localDefineLayout
Calculates the preferred color cell and tool sizes for
the GUI. It calls
localDefineColors and
localDefineTools
localDefineTools
Defines the tools shown in the palette. In this
example, the only tool is the Eraser button.
localDefineColors
Defines the colors that are shown in the array of
color cells.
processUserInputs
Determines if the property in a property/value pair
is supported. It calls
localValidateInput.
localValidateInput
Validates the value in a property/value pair.
Comentários a estes Manuais