## class fltk::NumericInput

### Class Hierarchy

    fltk::Input
       |
       +----fltk::NumericInput
               |
               +----fltk::FloatInput, fltk::IntInput

### Include Files

    #include <fltk/NumericInput.h>

### Description

The `fltk::NumericInput` class is a subclass of `fltk::Input` that redefines the up and down arrow keys to increment and decrement the digit of the number to the right of the cursor. This makes it very easy to edit numbers.

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.

This user interface design is Copyright (C) 2000-2002 Digital Domain. Patent Pending! License is ONLY granted to implement this algorithim as GPL or LGPL code (closed source may call an LGPL library to use it, however). License to use this technology in closed source code may be available:

Digital Domain
Intellectual Property
300 Rose Avenue, Venice, CA 90291, USA
(310)314-2800 FAX(310)314-2888

### Methods

- fltk::NumericInput
- ~NumericInput
- handle
- handle_arrow
- value

#### fltk::NumericInput::NumericInput(int x, int y, int w, int h, const char *label = 0)

Creates a new `fltk::NumericInput` widget using the given position, size, and label string. The text starts out blank (you may want to set it to "0").

#### virtual fltk::NumericInput::~NumericInput()

Destroys the widget and any value associated with it.

#### virtual int handle(int event)

The event handler checks for `fltk::Up` and `fltk::Down` keystrokes and calls handle_arrow() with them, otherwise it passes the events to the base class.

#### int handle_arrow(int direction)

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.

#### void value(double);

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.

#### void value(int);

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->value(),0,0)` yourself.

#### void value(const char* s);
const char* value() const;

Same as the methods from fltk::Input, these let you set or get the string value in the widget. You may also want static_value() if you have a string in static memory.