Specifications
3 Laying Out GUIs and Setting Properties
3-44
Setting Radio Button Properties
Radio buttons have two states — selected and not selected. You can query and
set the state of a radio button through its
Value property:
•
Value = Max, button is selected (1 by default)
•
Value = Min, button is not selected (0 by default)
To make radio buttons mutually exclusive within a group, the callback for each
radio button must set the
Value property to 0 on all other radio buttons in the
group. MATLAB sets the
Value property to 1 on the radio button clicked by the
user.
The following subfunction, when added to the GUI M-file, can be called by each
radio button callback. The argument is an array containing the handles of all
other radio buttons in the group that must be cleared.
function mutual_exclude(off)
set(off,'Value',0)
See “Radio Buttons” on page 4-9 for an example of such a function.
Setting Edit Text Box Properties
The values of the Min and Max properties for an edit text box determine whether
users can enter single or multiple lines of text:
• If
Max Min > 1, editable text boxes accept multiline input.
• If
Max Min <= 1, editable text boxes accept only single-line input.
Setting List Box Properties
List boxes display a list of items and enable users to select one or more items.
The
String property contains the list of strings displayed in the list box. The
first item in the list has an index of 1. Enter the list box items using the
Property Inspector, one per line.
The values of the
Min and Max properties for a list box determine whether users
can select single or multiple lines of text:
• If
Max Min > 1, users can select multiple lines.
• If
Max Min <= 1, users can select only a single line.