MATLAB Creating Graphical User Interfaces

(Barry) #1

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','slider' specifies the uicontrol to be a
slider.

'Min',0 and 'Max',100 specify the range of the slider to be [0, 100]. The Min property
must be less than Max.

'Value',25 sets the default slider position to 25. The number you specify for this
property must be within the range, [Min, Max].

'SliderStep',[0.05 0.2] specifies the fractional amount that the thumb moves
when the user clicks the arrow buttons or the slider trough (also called the channel). In
this case, the slider’s thumb position changes by the smaller amount (5 percent) when the
user clicks an arrow button. It changes by the larger amount (20 percent) when the user
clicks the trough.

Specify SliderStep to be a two-element vector, [minor_step major_step]. The
value of minor_step must be less than or equal to major_step. To ensure the best
results, do not specify either value to be less than 1e-6. Setting major_step to 1 or
higher causes the thumb to move to Max or Min when the trough is clicked.

As major_step increases, the thumb grows longer. When major_step is 1, the thumb
is half as long as the trough. When major_step is greater than 1, the thumb continues
to grow, slowly approaching the full length of the trough. When a slider serves as a scroll
Free download pdf