wxRuby Documentation Home

# Wx::Slider

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.

Slider events are handled in the same way as a scrollbar.

## Derived from

Control

Window

EvtHandler

Object

## Window styles

`SL_HORIZONTAL` | Displays the slider horizontally (this is the default).
`SL_VERTICAL` | Displays the slider vertically.
`SL_AUTOTICKS` | Displays tick marks.
`SL_LABELS` | Displays minimum, maximum and value labels.
`SL_LEFT` | Displays ticks on the left and forces the slider to be vertical.
`SL_RIGHT` | Displays ticks on the right and forces the slider to be vertical.
`SL_TOP` | Displays ticks on the top.
`SL_BOTTOM` | Displays ticks on the bottom (this is the default).
`SL_SELRANGE` | Allows the user to select a range on the slider. Windows only.
`SL_INVERSE` | Inverses the mininum and maximum endpoints on the slider. Not compatible with SL_SELRANGE.

See also window styles overview.

scrolevt.inc

## See also

Event handling overview, ScrollBar

## Methods

- Slider.new
- Slider#clear_sel
- Slider#clear_ticks
- Slider#create
- Slider#get_line_size
- Slider#get_max
- Slider#get_min
- Slider#get_page_size
- Slider#get_sel_end
- Slider#get_sel_start
- Slider#get_thumb_length
- Slider#get_tick_freq
- Slider#get_value
- Slider#set_line_size
- Slider#set_page_size
- Slider#set_range
- Slider#set_selection
- Slider#set_thumb_length
- Slider#set_tick
- Slider#set_tick_freq
- Slider#set_value

### Slider.new

Slider.new(%(arg-type)Window% parent, Integer id, Integer value , Integer minValue, Integer maxValue, Point point = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = SL_HORIZONTAL, Validator validator = DEFAULT_VALIDATOR, String name = “slider”)

Constructor, creating and showing a slider.

#### Parameters

- parent Parent window. Must not be NULL.
- id Window identifier. A value of -1 indicates a default value.
- value Initial position for the slider.
- minValue Minimum slider position.
- maxValue Maximum slider position.
- size Window size. If the default size (-1, -1) is specified then a default size is chosen.
- style Window style. See Slider.
- validator Window validator.
- name Window name.

#### See also

Slider#create, Validator

destructor()

Destructor, destroying the slider.

### Slider#clear_sel

clear_sel()

Clears the selection, for a slider with the SL_SELRANGE style.

#### Remarks

Windows 95 only.

### Slider#clear_ticks

clear_ticks()

Clears the ticks.

#### Remarks

Windows 95 only.

### Slider#create

Boolean create(%(arg-type)Window% parent, Integer id, Integer value , Integer minValue, Integer maxValue, Point point = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = SL_HORIZONTAL, Validator validator = DEFAULT_VALIDATOR, String name = “slider”)

Used for two-step slider construction. See Slider.new for further details.

### Slider#get_line_size

Integer get_line_size()

Returns the line size.

#### See also

Slider#set_line_size

### Slider#get_max

Integer get_max()

Gets the maximum slider value.

#### See also

Slider#get_min, Slider#set_range

### Slider#get_min

Integer get_min()

Gets the minimum slider value.

#### See also

Slider#get_min, Slider#set_range

### Slider#get_page_size

Integer get_page_size()

Returns the page size.

#### See also

Slider#set_page_size

### Slider#get_sel_end

Integer get_sel_end()

Returns the selection end point.

#### Remarks

Windows 95 only.

#### See also

Slider#get_sel_start, Slider#set_selection

### Slider#get_sel_start

Integer get_sel_start()

Returns the selection start point.

#### Remarks

Windows 95 only.

#### See also

Slider#get_sel_end, Slider#set_selection

### Slider#get_thumb_length

Integer get_thumb_length()

Returns the thumb length.

#### Remarks

Windows 95 only.

#### See also

Slider#set_thumb_length

### Slider#get_tick_freq

Integer get_tick_freq()

Returns the tick frequency.

#### Remarks

Windows 95 only.

#### See also

Slider#set_tick_freq

### Slider#get_value

Integer get_value()

Gets the current slider value.

#### See also

Slider#get_min, Slider#get_max, Slider#set_value

### Slider#set_line_size

set_line_size(%(arg-type)Integer% lineSize)

Sets the line size for the slider.

#### Parameters

- lineSize The number of steps the slider moves when the user moves it up or down a line.

#### See also

Slider#get_line_size

### Slider#set_page_size

set_page_size(%(arg-type)Integer% pageSize)

Sets the page size for the slider.

#### Parameters

- pageSize The number of steps the slider moves when the user pages up or down.

#### See also

Slider#get_page_size

### Slider#set_range

set_range(%(arg-type)Integer% minValue, Integer maxValue)

Sets the minimum and maximum slider values.

#### See also

Slider#get_min, Slider#get_max

### Slider#set_selection

set_selection(%(arg-type)Integer% startPos, Integer endPos)

Sets the selection.

#### Parameters

- startPos The selection start position.
- endPos The selection end position.

#### Remarks

Windows 95 only.

#### See also

Slider#get_sel_start, Slider#get_sel_end

### Slider#set_thumb_length

set_thumb_length(%(arg-type)Integer% len)

Sets the slider thumb length.

#### Parameters

- len The thumb length.

#### Remarks

Windows 95 only.

#### See also

Slider#get_thumb_length

### Slider#set_tick

set_tick(%(arg-type)Integer% tickPos)

Sets a tick position.

#### Parameters

- tickPos The tick position.

#### Remarks

Windows 95 only.

#### See also

Slider#set_tick_freq

### Slider#set_tick_freq

set_tick_freq(%(arg-type)Integer% n, Integer pos)

Sets the tick mark frequency and position.

#### Parameters

- n Frequency. For example, if the frequency is set to two, a tick mark is displayed for
  every other increment in the slider’s range.
- pos Position. Must be greater than zero. TODO: what is this for?

#### Remarks

Windows 95 only.

#### See also

Slider#get_tick_freq

### Slider#set_value

set_value(%(arg-type)Integer% value)

Sets the slider position.

#### Parameters

- value The slider position.

#### See also

Slider#get_value

[This page automatically generated from the Textile source at 2023-06-09 00:45:24 +0000]