User`s guide

Color Palette
The example also includes the helper functions listed in the following table.
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 show n 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.
Code File Organization
The color palette GUI is programmed using nested functions. Its code file is
organized in the following sequence:
1 Comments displayed in response to the help command.
2 Data creation. Because the example uses n ested functions, defining this
data at the top level makes the data accessible to all functions without
having to pass them as arguments.
3 Command line input processing.
4 GUI figure and component creation.
5 GUI initialization.
6 Return output if it is requested.
15-57