The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FLTK::NumericInput - One-line text input field for basic math and numeric expressions

Description

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.

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.

When you construct the widget the text starts out blank. You may want to set it with value( 0 ) or something.

Functions

new

my $input = $numericinput->new( $x, $y, $w, $h, $label );

Creates a new FLTK::NumericInput object.

value

$numericinput->value( $val );

Correctly formats $val and uses the result to set the string value.

my $val = $numericinput->value( );

Returns the value. Duh.

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

License and Legal

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.