Public Member Functions

# wxSpinButton Class Reference
[Controls]

`#include <wx/spinbutt.h>`

Inheritance diagram for wxSpinButton:
[legend]

## Detailed Description

A wxSpinButton 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 wxSpinCtrl instead as wxSpinButton is not implemented for all platforms but wxSpinCtrl is as it degenerates to a simple wxTextCtrl on such platforms.

Note:
  the range supported by this control (and wxSpinCtrl) 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.

## Styles

This class supports the following styles:

- wxSP_HORIZONTAL:
  Specifies a horizontal spin button (note that this style is not supported in wxGTK).
- wxSP_VERTICAL:
  Specifies a vertical spin button.
- wxSP_ARROW_KEYS:
  The user can use arrow keys to change the value.
- wxSP_WRAP:
  The value wraps at the minimum and maximum.

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxSpinEvent& event)

Event macros for events emitted by this class:

- EVT_SPIN(id, func):
  Generated whenever an arrow is pressed.
- EVT_SPIN_UP(id, func):
  Generated when left/up arrow is pressed.
- EVT_SPIN_DOWN(id, func):
  Generated when right/down arrow is pressed.

Note that if you handle both SPIN and UP or DOWN events, you will be notified about each of them twice: first the UP/DOWN event will be received and then, if it wasn't vetoed, the SPIN event will be sent.

##

Library: wxCore
Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  wxSpinCtrl

## Public Member Functions
| wxSpinButton ()
| Default constructor.
| wxSpinButton (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_VERTICAL, const wxString &name="spinButton")
| Constructor, creating and showing a spin button.
virtual | ~wxSpinButton ()
| Destructor, destroys the spin button control.
bool | Create (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSP_VERTICAL, const wxString &name="wxSpinButton")
| Scrollbar creation function called by the spin button constructor.
virtual int | GetMax () const
| Returns the maximum permissible value.
virtual int | GetMin () const
| Returns the minimum permissible value.
virtual int | GetValue () const
| Returns the current spin button value.
virtual void | SetRange (int min, int max)
| Sets the range of the spin button.
virtual void | SetValue (int value)
| Sets the value of the spin button.

List of all members.

## Constructor & Destructor Documentation

wxSpinButton::wxSpinButton | ( |  | ) |

Default constructor.

wxSpinButton::wxSpinButton | ( | wxWindow * | parent,
|  | wxWindowID | id = `-1`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `wxSP_VERTICAL`,
|  | const wxString & | name = `"spinButton"` |
| ) |  |  |

Constructor, creating and showing a spin button.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. The value wxID_ANY indicates a default value.
  | pos | Window position. If wxDefaultPosition is specified then a default position is chosen.
  | size | Window size. If wxDefaultSize is specified then a default size is chosen.
  | style | Window style. See wxSpinButton class description.
  | name | Window name.

See also:
  Create()

virtual wxSpinButton::~wxSpinButton | ( |  | ) | `[virtual]`

Destructor, destroys the spin button control.

## Member Function Documentation

bool wxSpinButton::Create | ( | wxWindow * | parent,
|  | wxWindowID | id = `-1`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `wxSP_VERTICAL`,
|  | const wxString & | name = `"wxSpinButton"` |
| ) |  |  |

Scrollbar creation function called by the spin button constructor.

See wxSpinButton() for details.

Reimplemented from wxWindow.

virtual int wxSpinButton::GetMax | ( |  | ) | const`[virtual]`

Returns the maximum permissible value.

See also:
  SetRange()

virtual int wxSpinButton::GetMin | ( |  | ) | const`[virtual]`

Returns the minimum permissible value.

See also:
  SetRange()

virtual int wxSpinButton::GetValue | ( |  | ) | const`[virtual]`

Returns the current spin button value.

See also:
  SetValue()

virtual void wxSpinButton::SetRange | ( | int | min,
|  | int | max |
| ) |  |  | `[virtual]`

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:
  GetMin(), GetMax()

virtual void wxSpinButton::SetValue | ( | int | value | ) | `[virtual]`

Sets the value of the spin button.

Parameters:

  | value | The value for the spin button.

|  | [ top ]