wxRuby Documentation Home

# Wx::SpinButton

A SpinButton has two small up and down (or left and right) arrow buttons. It
is often used next to a text control for increment and decrementing a value.
Portable programs should try to use SpinCtrl instead
as SpinButton is not implemented for all platforms but SpinCtrl is as it
degenerates to a simple TextCtrl on such platforms.

NB: the range supported by this control (and SpinCtrl) depends on the
platform but is at least `-0x8000` to `0x7fff`. Under GTK and
Win32 with sufficiently new version of `comctrl32.dll` (at least 4.71 is
required, 5.80 is recommended) the full 32 bit range is supported.

## Derived from

Control

Window

EvtHandler

Object

## See also

SpinCtrl

## Window styles

`SP_HORIZONTAL` | Specifies a horizontal spin button (note that this style is not supported in GTK).
`SP_VERTICAL` | Specifies a vertical spin button.
`SP_ARROW_KEYS` | The user can use arrow keys to change the value.
`SP_WRAP` | The value wraps at the minimum and maximum.

See also window styles overview.

spinevt.inc

## See also

Event handling overview

## Methods

- SpinButton.new
- SpinButton#create
- SpinButton#get_max
- SpinButton#get_min
- SpinButton#get_value
- SpinButton#set_range
- SpinButton#set_value

### SpinButton.new

SpinButton.new(%(arg-type)Window% parent, Integer id, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = SP_HORIZONTAL, String name = “spinButton”)

Constructor, creating and showing a spin button.

#### Parameters

- parent Parent window. Must not be NULL.
- id Window identifier. A value of -1 indicates a default value.
- pos Window position. If the position (-1, -1) is specified then a default position is chosen.
- size Window size. If the default size (-1, -1) is specified then a default size is chosen.
- style Window style. See SpinButton.
- name Window name.

#### See also

SpinButton#create

destructor()

Destructor, destroys the spin button control.

### SpinButton#create

Boolean create(%(arg-type)Window% parent, Integer id, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = SP_HORIZONTAL, String name = “spinButton”)

Scrollbar creation function called by the spin button constructor.
See SpinButton.new for details.

### SpinButton#get_max

Integer get_max()

Returns the maximum permissible value.

#### See also

SpinButton#set_range

### SpinButton#get_min

Integer get_min()

Returns the minimum permissible value.

#### See also

SpinButton#set_range

### SpinButton#get_value

Integer get_value()

Returns the current spin button value.

#### See also

SpinButton#set_value

### SpinButton#set_range

set_range(%(arg-type)Integer% min, Integer max)

Sets the range of the spin button.

#### Parameters

- min The minimum value for the spin button.
- max The maximum value for the spin button.

#### See also

SpinButton#get_min, SpinButton#get_max

### SpinButton#set_value

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

Sets the value of the spin button.

#### Parameters

- value The value for the spin button.

#### See also

SpinButton#get_value

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