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.

NB: 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.

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 to change the value.
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 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 receieved and then, if it wasn't vetoed, the SPIN event will be sent.

See also

Event handling overview



wxSpinButton::wxSpinButton



wxSpinButton(void)

Default constructor.



wxSpinButton(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSP_HORIZONTAL, const wxString& 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 wxSpinButton.

validator
Window validator.

name
Window name.

See also

wxSpinButton::Create, wxValidator



wxSpinButton::~wxSpinButton



void ~wxSpinButton(void)

Destructor, destroys the spin button control.



wxSpinButton::Create



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

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



wxSpinButton::GetMax

int GetMax(void) const

Returns the maximum permissible value.

See also

wxSpinButton::SetRange



wxSpinButton::GetMin

int GetMin(void) const

Returns the minimum permissible value.

See also

wxSpinButton::SetRange



wxSpinButton::GetValue

int GetValue(void) 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
The minimum value for the spin button.

max
The maximum value for the spin button.

See also

wxSpinButton::GetMin, wxSpinButton::GetMax



wxSpinButton::SetValue



void SetValue(int value)

Sets the value of the spin button.

Parameters

value
The value for the spin button.

See also

wxSpinButton::GetValue

ymasuda 平成17年11月19日