Inherited by fltk::FloatInput.
If you change when() to fltk::WHEN_ENTER_KEY the callback is only done when the user hits the up/down arrow keys or when the user types the Enter key. This may be more useful than the default setting of fltk::WHEN_CHANGED which can make the callback happen when partially-edited numbers are in the field.
This version lets the user type any text into the field. This is useful if you run the text through an expression parser so the user can type in math expressions. However if you want to limit the input to text that can be run through strtol() or strtod() you should use the subclasses fltk::IntInput or fltk::FloatInput.
When you construct the widget the text starts out blank. You may want to set it with value(0) or something.
This user interface design is Copyright (C) 2000-2003 Digital Domain. Patent Pending!
License is ONLY granted to implement this algorithim as GPL, LGPL, or FLTK licensed code. Note that by using fltk you may use this in a closed-source program.
License to use this technology in other cases may be available:
D2 Software / Digital Domain
300 Rose Avenue, Venice, CA 90291, USA
(310)314-2800 FAX(310)314-2888
Public Member Functions | |
int | handle (int) |
NumericInput (int x, int y, int w, int h, const char *l=0) | |
void | value (int) |
void | value (double) |
Protected Member Functions | |
int | handle_arrow (int) |
|
Do the work of up-arrow (if direction is greater than zero) or down-arrow if direction is less than zero. This protected method is available so subclasses can change what keys do this, or invert the direction of the arrows. |
|
Does a %g sprintf of the value and uses the result to set the string value. Notice that there is no inverse function, you will have to call strtod(widget->value(),0,0) yourself. |
|
Does a %d sprintf of the value and uses the result to set the string value. Notice that there is no inverse function, you will have to call strtol(widget->text(),0,0) yourself. |
|
Does the up/down arrows and mouse wheel. Alt+drag also adjusts the value. All other points are sent to the Input base class. Reimplemented from fltk::Input. |