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 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 WHEN_CHANGED which can make the callback happen when partially-edited numbers are in the field.
when( )
WHEN_ENTER_KEY
Enter
WHEN_CHANGED
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 IntInput or FloatInput.
strtol()
strtod()
When you construct the widget the text starts out blank. You may want to set it with value( 0 ) or something.
value( 0 )
new
my $input = $numericinput->new( $x, $y, $w, $h, $label );
Creates a new FLTK::NumericInput object.
FLTK::NumericInput
value
$numericinput->value( $val );
Correctly formats $val and uses the result to set the string value.
$val
my $val = $numericinput->value( );
Returns the value. Duh.
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.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.
To install FLTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FLTK
CPAN shell
perl -MCPAN -e shell install FLTK
For more information on module installation, please visit the detailed CPAN module installation guide.