## wxSpinCtrl

wxSpinCtrl combines wxTextCtrl and wxSpinButton in one control.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/spinctrl.h>

Window styles

wxSP_ARROW_KEYS | The user can use arrow keys.
wxSP_WRAP | The value wraps at the minimum and maximum.

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_SPINCTRL(id, func) | Generated whenever spinctrl is updated

See also

Event handling overview, wxSpinButton, wxControl

Members

wxSpinCtrl::wxSpinCtrl
wxSpinCtrl::Create
wxSpinCtrl::SetValue
wxSpinCtrl::GetValue
wxSpinCtrl::SetRange
wxSpinCtrl::GetMin
wxSpinCtrl::GetMax

### wxSpinCtrl::wxSpinCtrl

wxSpinCtrl()

Default constructor.

wxSpinCtrl(wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = _T("wxSpinCtrl"))

Constructor, creating and showing a spin control.

Parameters

parent

Parent window. Must not be NULL.

value

Default value.

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

min

Minimal value.

max

Maximal value.

initial

Initial value.

name

Window name.

See also

wxSpinCtrl::Create

### wxSpinCtrl::Create

bool Create(wxWindow* parent, wxWindowID id = -1, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_ARROW_KEYS, int min = 0, int max = 100, int initial = 0, const wxString& name = _T("wxSpinCtrl"))

Creation function called by the spin control constructor.

See wxSpinCtrl::wxSpinCtrl for details.

### wxSpinCtrl::SetValue

void SetValue(const wxString& text)

void SetValue(int value)

Sets the value of the spin control.

### wxSpinCtrl::GetValue

int GetValue() const

Gets the value of the spin control.

### wxSpinCtrl::SetRange

void SetRange(int minVal, int maxVal)

Sets range of allowable values.

### wxSpinCtrl::GetMin

int GetMin() const

Gets minimal allowable value.

### wxSpinCtrl::GetMax

int GetMax() const

Gets maximal allowable value.