Contents Up Previous Next

wxSpinButton

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 (Win32 and GTK only currently).

NB: the range supported by this control (and wxSpinCtrl) depends on the platform but is at least SHRT_MIN to SHRT_MAX.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

See also

wxSpinCtrl

Include files

<wx/spinbutt.h>

Window 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.
wxSP_WRAP The value wraps at the minimum and maximum.

See also window styles overview.

Event handling

To process input from a spin button, use one of these event handler macros to direct input to member functions that take a wxSpinEvent argument:

EVT_SPIN(id, func) Generated whenever an arros 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.
See also

Event handling overview

Members

wxSpinButton::wxSpinButton
wxSpinButton::~wxSpinButton
wxSpinButton::Create
wxSpinButton::GetMax
wxSpinButton::GetMin
wxSpinButton::GetValue
wxSpinButton::SetRange
wxSpinButton::SetValue


wxSpinButton::wxSpinButton

wxSpinButton()

Default constructor.

wxSpinButton(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = "spinButton")

Constructor, creating and showing a spin button.

Parameters

parent

id

pos

size

style

validator

name

See also

wxSpinButton::Create, wxValidator


wxSpinButton::~wxSpinButton

void ~wxSpinButton()

Destructor, destroying the spin button.


wxSpinButton::Create

bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_HORIZONTAL, const wxValidator& validator = wxDefaultValidator, const wxString& name = "spinButton")

Scrollbar creation function called by the spin button constructor. See wxSpinButton::wxSpinButton for details.


wxSpinButton::GetMax

int GetMax() const

Returns the maximum permissible value.

See also

wxSpinButton::SetRange


wxSpinButton::GetMin

int GetMin() const

Returns the minimum permissible value.

See also

wxSpinButton::SetRange


wxSpinButton::GetValue

int GetValue() const

Returns the current spin button value.

See also

wxSpinButton::SetValue


wxSpinButton::SetRange

void SetRange(int min, int max)

Sets the range of the spin button.

Parameters

min

max

See also

wxSpinButton::GetMin, wxSpinButton::GetMax


wxSpinButton::SetValue

void SetValue(int value)

Sets the value of the spin button.

Parameters

value

See also

wxSpinButton::GetValue