FLTK::NumericInput - One-line text input field for basic math and numeric expressions
The 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
the callback is only done when the user hits the up/down arrow keys or when the user types the
This may be more useful than the default setting of
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
strtod() you should use the subclasses IntInput or FloatInput.
When you construct the widget the text starts out blank.
You may want to set it with
value( 0 ) or something.
my $input = $numericinput->new( $x, $y, $w, $h, $label );
Creates a new
$numericinput->value( $val );
$val and uses the result to set the string value.
my $val = $numericinput->value( );
Returns the value. Duh.
Sanko Robinson <email@example.com> - http://sankorobinson.com/
Copyright (C) 2008-2010 by Sanko Robinson <firstname.lastname@example.org>
This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.