10 Lay Out a Programmatic UI
The first uicontrol argument, f, specifies the parent container. In this case, the parent
is a figure, but you can also specify the parent to be any container, such as a panel or
button group.
The name-value pair arguments, 'Style','togglebutton', specify the uicontrol to be
a toggle button.
'String','Left/Right Tile' puts a text label on the toggle button.
The 'Value',0 deselects the toggle button by default. To select (raise) the toggle button,
set Value equal to the Max property. To deselect the toggle button, set Value equal to the
Min property. By default, Min = 0 and Max = 1.
'Position',[30 20 100 30] specifies the location and size of the toggle button. In
this example, the toggle button is 100 pixels wide and 30 pixels high. It is positioned 30
pixels from the left of the figure and 20 pixels from the bottom.
Note:You can also display an icon on a toggle button. See “Displaying an Icon on a Push
Button” on page 10-10 for more information.
Check Box
This code creates a check box:
f = figure;
c = uicontrol(f,'Style','checkbox',...
'String','Display file extension',...