3.3.5 Controls
3.3.5.1 Button
3.3.5.2 Checkbox
3.3.5.3 Choice
3.3.5.4 Radio  Choice
3.3.5.5 List  Choice
3.3.5.6 Table
3.3.5.7 Slider
3.3.5.8 Progress
3.3.5.9 Input
3.3.5.10 Label
3.3.5.11 Image
3.3.5.12 Spacer
On this page:
Slider
Slider.at_  value
Slider.Style
Slider.Style.horizontal
Slider.Style.vertical
Slider.Style.plain
Slider.Style.horizontal_  label
Slider.Style.vertical_  label

image

class

class gui.Slider():

  implements WindowChildView

  constructor (

    ~label: label :: ObsOrValue.of(maybe(View.LabelString)) = #false,

    ~value: value :: ObsOrValue.of(View.PositionInt) = 0,

    ~min_value: min_value :: ObsOrValue.of(View.PositionInt) = 0,

    ~max_value: max_value :: ObsOrValue.of(View.PositionInt) = 100,

    ~action: action :: View.PositionInt -> ~any = values,

    ~enable: enable :: ObsOrValue.of(Boolean) = #true,

    ~margin: margin :: ObsOrValue.of(View.Margin) = [2, 2],

    ~min_size: min_size :: ObsOrValue.of(View.Size) = [#false, #false],

    ~stretch: stretch :: ObsOrValue.of(View.Stretch) = [#true, #true],

    ~styles: styles :: List.of(Slider.Style) = [#'horizontal],

    ~window_callbacks: window_callbacks :: maybe(WindowCallbacks) = #false

  )

 

property

property (sldr :: gui.Slider).at_value :: Obs.of(PositionInt)

Creates a slider. When rendered, the function call action(now_val) is performed when the slider is changed, where now_val indicates the value of the slider.

The Slider.at_value property returns an observable that is updated whenever the slider’s value changes through an action (as also reported via action) or via value as an observable.

The styles list must include one of #'horiziontal and #'vertical.

A slider style option:

  • #'horizontal: Creates a horizontal slider, where #'vertical and #'horizontal are mutually exclusive.

  • #'vertical: Creates a vertical slider.

  • #'plain: Creates an unadorned slider where the slider’s numerical value is not reported to the user.

  • #'horizontal_label: When the slider has a label, show it to the left of the slider. Horizontal label placement is the default if #'vertical_label is not specified, and #'horizontal_label and #'vertical_label are mutually exclusive.

  • #'vertical_label: When the slider has a label, show it above the control.