wxRuby Documentation Home

Wx::SpinCtrl

SpinCtrl combines TextCtrl and SpinButton in one control.

Derived from

Control

Window

EvtHandler

Object

Window styles

SP_ARROW_KEYS The user can use arrow keys to change the value.
SP_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 SpinEvent argument:

evt_spinctrl(id) { | event | ... } Generated whenever the numeric valueof the spinctrl is updated

You may also use the SpinButton event macros, however the corresponding events will not be generated under all platforms. Finally, if the user modifies the text in the edit part of the spin control directly, the EVT_TEXT is generated, like for the TextCtrl.

When the use enters text into the text area, the text is not validated until the control loses focus (e.g. by using the TAB key). The value is then adjusted to the range and a SpinEvent sent then if the value is different from the last value sent.

See also

Event handling overview, SpinButton, Control

Methods

SpinCtrl.new

SpinCtrl.new(Window parent,  Integer id = -1, 
             String value = '', 
             Point pos = DEFAULT_POSITION, 
             Size size = DEFAULT_SIZE, 
             Integer style = SP_ARROW_KEYS, 
             Integer min = 0, 
             Integer max = 100, 
             Integer initial = 0, 
             String name = _T("SpinCtrl"))

Constructor, creating and showing a spin control.

Parameters

See also

SpinCtrl#create

SpinCtrl#create

Boolean create(Window parent,  Integer id = -1, 
               String value = '', 
               Point pos = DEFAULT_POSITION, 
               Size size = DEFAULT_SIZE, 
               Integer style = SP_ARROW_KEYS, 
               Integer min = 0, 
               Integer max = 100, 
               Integer initial = 0, 
               String name = _T("SpinCtrl"))

Creation function called by the spin control constructor.

See SpinCtrl.new for details.

SpinCtrl#set_value

set_value(String text)
set_value(Integer value)

Sets the value of the spin control.

SpinCtrl#get_value

Integer get_value()

Gets the value of the spin control.

SpinCtrl#set_range

set_range(Integer minVal,  Integer maxVal)

Sets range of allowable values.

SpinCtrl#set_selection

set_selection(Integer from,  Integer to)

Select the text in the text part of the control between positions from (inclusive) and to (exclusive). This is similar to TextCtrl#set_selection.

NB: this is currently only implemented for Windows and generic versions of the control.

SpinCtrl#get_min

Integer get_min()

Gets minimal allowable value.

SpinCtrl#get_max

Integer get_max()

Gets maximal allowable value.

[This page automatically generated from the Textile source at Wed Sep 09 02:21:23 +0100 2009]