MATLAB Creating Graphical User Interfaces

(Barry) #1

6 Lay Out a UI Using GUIDE



  • Specify the range of the slider by setting its Min property to the minimum value of
    the slider and its Max property to the maximum value. The Min property must be less
    than Max.

  • Specify the value indicated by the slider when it is created by setting the Value
    property to the appropriate number. This number must be less than or equal to Max
    and greater than or equal to Min. If you specify Value outside the specified range, the
    slider is not displayed.

  • The slider Value changes by a small amount when a user clicks the arrow button,
    and changes by a larger amount when the user clicks the trough (also called
    the channel). Control how the slider responds to these actions by setting the
    SliderStep property. Specify SliderStep as a two-element vector, [minor_step
    major_step], where minor_step is less than or equal to major_step. Because
    specifying very small values can cause unpredictable slider behavior, make both
    minor_step and major_step greater than 1e-6. Set major_step to the proportion
    of the range that clicking the trough moves the slider thumb. Setting it 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 bar, you can uses this behavior to indicate how much of the
document is currently visible by changing the value of major_step.
Free download pdf