wxSlider(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– wxSlider πŸ’–

omg bestie come sit down, this is the Erlang module definition for wxSlider, and it's literally the little slider widget β€” you know, the one with a handle you pull back and forth to change a value. main character of every settings panel fr fr 🎚️✨


🌸 NAME 🌸

wxSlider β€” a slider is a control with a handle which can be pulled back and forth to change the value. that's it, that's the whole vibe. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, platform tea first:

  • On Windows, the track bar control is used.
  • On GTK+, tick marks are only available for version 2.16 and later.

Sliders generate the same events as wxScrollBar, no cap β€” but in practice the most convenient way to process wxSlider updates is by handling the slider-specific wxEVT_SLIDER event, which carries a wxCommandEvent containing just the latest slider position. chef's kiss 🫢

✨ Styles ✨

this class supports the following styles:

  • wxSL_HORIZONTAL: Displays the slider horizontally (this is the default). the standard girly pop πŸ’–
  • wxSL_VERTICAL: Displays the slider vertically.
  • wxSL_AUTOTICKS: Displays tick marks (Windows, GTK+ 2.16 and later).
  • wxSL_MIN_MAX_LABELS: Displays minimum, maximum labels (new since wxWidgets 2.9.1).
  • wxSL_VALUE_LABEL: Displays value label (new since wxWidgets 2.9.1).
  • wxSL_LABELS: Displays minimum, maximum and value labels (same as wxSL_VALUE_LABEL and wxSL_MIN_MAX_LABELS together).
  • wxSL_LEFT: Displays ticks on the left and forces the slider to be vertical (Windows and GTK+ 3 only).
  • wxSL_RIGHT: Displays ticks on the right and forces the slider to be vertical.
  • wxSL_TOP: Displays ticks on the top (Windows and GTK+ 3 only).
  • wxSL_BOTTOM: Displays ticks on the bottom (this is the default).
  • wxSL_BOTH: Displays ticks on both sides of the slider. Windows only.
  • wxSL_SELRANGE: Displays a highlighted selection range. Windows only.
  • wxSL_INVERSE: Inverses the minimum and maximum endpoints on the slider. Not compatible with wxSL_SELRANGE. Notice that wxSL_LEFT, wxSL_TOP, wxSL_RIGHT and wxSL_BOTTOM specify the position of the slider ticks and that the slider labels, if any, are positioned on the opposite side. So, to have a label on the left side of a vertical slider, wxSL_RIGHT must be used (or none of these styles at all should be specified as left and top are default positions for the vertical and horizontal sliders respectively).

πŸŽ€ The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED πŸŽ€

okay this part matters, don't skip it, iykyk:

The EVT_SCROLL_THUMBRELEASE event is only emitted when actually dragging the thumb using the mouse and releasing it (This EVT_SCROLL_THUMBRELEASE event is also followed by an EVT_SCROLL_CHANGED event).

The EVT_SCROLL_CHANGED event also occurs when using the keyboard to change the thumb position, and when clicking next to the thumb (In all these cases the EVT_SCROLL_THUMBRELEASE event does not happen). In short, the EVT_SCROLL_CHANGED event is triggered when scrolling/ moving has finished independently of the way it had started. Please see the page_samples_widgets ("Slider" page) to see the difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED in action.

See:

  • Overview events
  • wxScrollBar

This class is derived, and can use functions, from:

  • wxControl
  • wxWindow
  • wxEvtHandler

wxWidgets docs: wxSlider

🌈 Events 🌈

Event types emitted from this class:

  • scroll_top
  • scroll_bottom
  • scroll_lineup
  • scroll_linedown
  • scroll_pageup
  • scroll_pagedown
  • scroll_thumbtrack
  • scroll_thumbrelease
  • scroll_changed
  • scroll_top
  • scroll_bottom
  • scroll_lineup
  • scroll_linedown
  • scroll_pageup
  • scroll_pagedown
  • scroll_thumbtrack
  • scroll_thumbrelease
  • scroll_changed
  • command_slider_updated
not me noticing the whole scroll list shows up twice πŸ™ˆ bestie i checked, that's genuinely how it's written, so i'm keeping both. no editing the source, periodt.

πŸ’œ DATA TYPES πŸ’œ

wxSlider() :: wx:wx_object().

πŸ‘‘ FUNCTIONS πŸ‘‘

⭐ create/7 ⭐

create(This, Parent, Id, Value, MinValue, MaxValue, [Option]) ->
                boolean()
                when
                    This :: wxSlider(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Value :: integer(),
                    MinValue :: integer(),
                    MaxValue :: integer(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

Used for two-step slider construction.

See new/6 for further details. it's giving "build it now, finish it later" πŸ’…

⭐ destroy/1 ⭐

destroy(This :: wxSlider()) -> ok.

Destroys the object. bye bestie, it's over 😭

⭐ getLineSize/1 ⭐

getLineSize(This) -> integer() when This :: wxSlider().

Returns the line size.

See: setLineSize/2

⭐ getMax/1 ⭐

getMax(This) -> integer() when This :: wxSlider().

Gets the maximum slider value.

See:

  • getMin/1
  • setRange/3

⭐ getMin/1 ⭐

getMin(This) -> integer() when This :: wxSlider().

Gets the minimum slider value.

See:

  • getMin/1
  • setRange/3
yeah getMin/1 pointing at getMin/1 is a whole self-love moment πŸ’€ that's literally what the page says so i'm not touching it.

⭐ getPageSize/1 ⭐

getPageSize(This) -> integer() when This :: wxSlider().

Returns the page size.

See: setPageSize/2

⭐ getThumbLength/1 ⭐

getThumbLength(This) -> integer() when This :: wxSlider().

Returns the thumb length.

Only for: wxmsw

See: setThumbLength/2

⭐ getValue/1 ⭐

getValue(This) -> integer() when This :: wxSlider().

Gets the current slider value.

See:

  • getMin/1
  • getMax/1
  • setValue/2

⭐ new/0 ⭐

new() -> wxSlider().

Default constructor. blank slate energy ✨

⭐ new/6 ⭐

new(Parent, Id, Value, MinValue, MaxValue, [Option]) -> wxSlider()
                when
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Value :: integer(),
                    MinValue :: integer(),
                    MaxValue :: integer(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

Constructor, creating and showing a slider. glow up included 🌟

See: create/7

⭐ setLineSize/2 ⭐

setLineSize(This, LineSize) -> ok
                        when This :: wxSlider(), LineSize :: integer().

Sets the line size for the slider.

See: getLineSize/1

⭐ setPageSize/2 ⭐

setPageSize(This, PageSize) -> ok
                        when This :: wxSlider(), PageSize :: integer().

Sets the page size for the slider.

See: getPageSize/1

⭐ setRange/3 ⭐

setRange(This, MinValue, MaxValue) -> ok
                     when
                         This :: wxSlider(),
                         MinValue :: integer(),
                         MaxValue :: integer().

Sets the minimum and maximum slider values.

See:

  • getMin/1
  • getMax/1

⭐ setThumbLength/2 ⭐

setThumbLength(This, Len) -> ok
                           when This :: wxSlider(), Len :: integer().

Sets the slider thumb length.

Only for: wxmsw

See: getThumbLength/1

⭐ setValue/2 ⭐

setValue(This, Value) -> ok
                     when This :: wxSlider(), Value :: integer().

Sets the slider position.


aaaand that's the whole page bestie, you ate it πŸ“πŸ’… if you're reading this at 3am debugging a slider that won't slide, i love you, go drink water 🫢

this lil love letter to wxSlider(3) came to you from Ericsson AB, living in the wx 2.6 era β€” so iconic, so vintage, so slay. bye pookie πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from