FLTK::Button - Push button widget
Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for when():
when()
FLTK::WHEN_NEVER
changed()
FLTK::WHEN_RELEASE
FLTK::WHEN_CHANGED
value()
Buttons can also generate callbacks in response to FLTK::SHORTCUT events. The button can either have an explicit shortcut() value or a letter shortcut can be indicated in the label() with an & character before it. For the label shortcut it does not matter if Alt is held down, but if you have an input field in the same window, the user will have to hold down the Alt key so that the input field does not eat the event first as an FLTK::KEY event.
FLTK::SHORTCUT
shortcut()
label()
&
Alt
FLTK::KEY
HIDDEN
HIDDEN( );
Back-comptability value to hide the button
default_style
my $style = $button->default_style( );
Get the style
$button->default_style( $style );
Set the style.
new
my $self = $button->new( $x, $y, $w, $h, $label );
Creates a new FLTK::Button object. Obviously.
FLTK::Button
value
$button->value( $val );
Change the value(). Redraws the button and returns true if the new value is different. This is the same function as Widget::state(). See also Widget::set(), Widget::clear(), and Widget::setonly().
Widget::state()
Widget::set()
Widget::clear()
Widget::setonly()
If you turn it on, a normal button will draw pushed-in, until the user clicks it and releases it.
my $val = $button->value( );
The current value. true means it is pushed down, false means it is not pushed down. The ToggleButton subclass provides the ability for the user to change this value permanently, otherwise it is just temporary while the user is holding the button down.
true
false
This is the same as Widget::state().
Blah, blah, blah...
draw( $glyph_width )
This function provides a mess of back-compatabilty and Windows emulation to subclasses of Button to draw with. It will draw the button according to the current state of being pushed and it's state(). If non-zero is passed for GLYPH_WIDTH then the glyph() is drawn in that space on the left (or on the right if negative), and it assummes the glyph indicates the state(), so the box is only used to indicate the pushed state.
state()
GLYPH_WIDTH
glyph()
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.