Search documentation of wx

# View Source wxSlider (wx v2.4.2)

Functions for wxSlider class

A slider is a control with a handle which can be pulled back and forth to change the value.

On Windows, the track bar control is used.

On GTK+, tick marks are only available for version 2.16 and later.

Slider generates the same events as `wxScrollBar` but in practice the most convenient way to process `wxSlider` updates is by handling the slider-specific `wxEVT_SLIDER` event which carries `wxCommandEvent` containing just the latest slider position.

Styles

This class supports the following styles:

The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED

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`

# Summary

## Types

wxSlider()

## Functions

create(This, Parent, Id, Value, MinValue, MaxValue)
create/7

Used for two-step slider construction.

destroy(This)

Destructor, destroying the slider.

getLineSize(This)

Returns the line size.

getMax(This)

Gets the maximum slider value.

getMin(This)

Gets the minimum slider value.

getPageSize(This)

Returns the page size.

getThumbLength(This)

Returns the thumb length.

getValue(This)

Gets the current slider value.

new()

Default constructor.

new(Parent, Id, Value, MinValue, MaxValue)
new/6

Constructor, creating and showing a slider.

setLineSize(This, LineSize)

Sets the line size for the slider.

setPageSize(This, PageSize)

Sets the page size for the slider.

setRange(This, MinValue, MaxValue)

Sets the minimum and maximum slider values.

setThumbLength(This, Len)

Sets the slider thumb length.

setValue(This, Value)

Sets the slider position.

# Types

Link to this type

# wxSlider()

View Source

    -type wxSlider() :: wx:wx_object().

# Functions

Link to this function

# create(This, Parent, Id, Value, MinValue, MaxValue)

View Source

    -spec create(This, Parent, Id, Value, MinValue, MaxValue) -> boolean()
                    when
                        This :: wxSlider(),
                        Parent :: wxWindow:wxWindow(),
                        Id :: integer(),
                        Value :: integer(),
                        MinValue :: integer(),
                        MaxValue :: integer().

Link to this function

# create/7

View Source

    -spec 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.

Link to this function

# destroy(This)

View Source

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

Destructor, destroying the slider.

Link to this function

# getLineSize(This)

View Source

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

Returns the line size.

See: `setLineSize/2`

Link to this function

# getMax(This)

View Source

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

Gets the maximum slider value.

See: `getMin/1`, `setRange/3`

Link to this function

# getMin(This)

View Source

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

Gets the minimum slider value.

See: `getMin/1`, `setRange/3`

Link to this function

# getPageSize(This)

View Source

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

Returns the page size.

See: `setPageSize/2`

Link to this function

# getThumbLength(This)

View Source

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

Returns the thumb length.

Only for:wxmsw

See: `setThumbLength/2`

Link to this function

# getValue(This)

View Source

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

Gets the current slider value.

See: `getMin/1`, `getMax/1`, `setValue/2`

Link to this function

# new()

View Source

    -spec new() -> wxSlider().

Default constructor.

Link to this function

# new(Parent, Id, Value, MinValue, MaxValue)

View Source

    -spec new(Parent, Id, Value, MinValue, MaxValue) -> wxSlider()
                 when
                     Parent :: wxWindow:wxWindow(),
                     Id :: integer(),
                     Value :: integer(),
                     MinValue :: integer(),
                     MaxValue :: integer().

Link to this function

# new/6

View Source

    -spec 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.

See: `create/7`, `wxValidator` (not implemented in wx)

Link to this function

# setLineSize(This, LineSize)

View Source

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

Sets the line size for the slider.

See: `getLineSize/1`

Link to this function

# setPageSize(This, PageSize)

View Source

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

Sets the page size for the slider.

See: `getPageSize/1`

Link to this function

# setRange(This, MinValue, MaxValue)

View Source

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

Sets the minimum and maximum slider values.

See: `getMin/1`, `getMax/1`

Link to this function

# setThumbLength(This, Len)

View Source

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

Sets the slider thumb length.

Only for:wxmsw

See: `getThumbLength/1`

Link to this function

# setValue(This, Value)

View Source

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

Sets the slider position.