
12 Examples of GUIs Created Programmatically
12-34
The Components
The GUI includes the following components:
• A edit text that instructs the user or contains the name of the file to be
edited. The edit text is labeled using a static text.
• A push button to the right of the edit text enables the user to select an
existing icon file for editing.
• A panel containing an axes. The axes displays a 16-by-16 grid for drawing an
icon.
• A panel containing a button that shows a preview of the icon as it is being
created.
• A color palette that is created in a separate script and embedded in this GUI.
See “Color Palette” on page 12-22.
• A panel, configured as a line, that separates the icon editor from the
OK and
Cancel buttons.
• An
OK push button that causes the GUI to return the icon as an m-by-n-by-3
array and closes the GUI.
• A
Cancel push button that closes the GUI without returning the icon.
Using the Icon Editor
These are the basic steps to create an icon:
1 Start the icon editor with a command such as
myicon = iconEditor('iconwidth',32,'iconheight',56);
where the iconwidth and iconheight properties specify the icon size in
pixels.
2 Color the squares in the grid.
- Click a color cell in the palette. That color is then displayed in the palette
preview.
- Click in specific squares of the grid to transfer the selected color to those
squares.
- Hold down the left mouse button and drag the mouse over the grid to
transfer the selected color to the squares that you touch.
- Change a color by writing over it with another color.
Komentarze do niniejszej Instrukcji