SpinCtrl combines TextCtrl and SpinButton in one control.
SP_ARROW_KEYS |
The user can use arrow keys to change the value. |
SP_WRAP |
The value wraps at the minimum and maximum. |
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.
Event handling overview, SpinButton, Control
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.
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.
set_value(String text)
set_value(Integer value)
Sets the value of the spin control.
Integer get_value()
Gets the value of the spin control.
set_range(Integer minVal, Integer maxVal)
Sets range of allowable values.
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.
Integer get_min()
Gets minimal allowable value.
Integer get_max()
Gets maximal allowable value.
[This page automatically generated from the Textile source at Wed Sep 09 02:21:23 +0100 2009]