User`s guide

6 Lay Out a GUIDE GUI
software sets Value to Max,andtoMin when the user deselects it. The
following figure shows the toggle button in the depressed position.
If you want to s
et the position or size of the component to an exact value,
then modify i
ts
Position property. See “Locate and Move Components” on
page 6-83 and “R
esize Components” on page 6-86 for details.
To add an imag
e to a toggle button, assign the button’s
CData property
an m-by-n-b
y-3 array of RGB values that defines a truecolor image. You
must do this
programmatically in the opening function of the GUI code file.
For exampl
e, the array
img defines a 16-by-64-by-3 truecolor image using
random val
ues between 0 and 1 (generated by
rand).
img = rand(16,64,3);
set(handles.togglebutton1,'CData',i mg);
where tog
glebutton1
is the toggle button’s Tag property.
Note To manage exclusive selection of radio buttons and toggle buttons,
put them in a button group. See “Button Group” on page 6-60 for more
information.
Define Panels and Button Groups
Panels and button groups are containers that arrange GUI components into
groups. If you move the panel or button group, its children move with it and
maintain their positions relative to the panel or button group.
To define panels and button g roups, you must s et certain properties. T o do
this:
6-56