Fl::Slider - Widget with a Sliding Knob Inside a Box
The Fl::Slider widget contains a sliding knob inside a box.
It is often used as a scrollbar. Moving the box all the way to the top/left sets it to the minimum(), and to the bottom/right to the maximum(). The minimum() may be greater than the maximum() to reverse the slider direction.
Use Fl::Widget->type($type) to set how the slider is drawn, which can be one of the following:
All of these values can be imported with the :type tag.
:type
Fl::Slider inherits from Fl::Valuator and Fl::Widget. On top of that, it exposes the following methods...
my $val_a = Fl::Slider->new(0, 0, 250, 500, 'Important Stuff'); my $val_b = Fl::Slider->new(0, 0, 250, 500);
The constructor creates a new widget using the given position, size, and label.
The default boxtype is FL_DOWN_BOX.
The destructor removes the widget.
$val_b->bounds($a, $b);
Sets the minimum ($a) and maximum ($b) values for the valuator widget. If either values is changed, a partial redraw is asked.
$a
$b
my $value = $val_a->scrollvalue($pos, $size, $first, $total);
Sets the size and position of the sliding knob in the box.
$pos would be the position of the first line displayed, $size is the size of the window in lines, $first is the number of the first line, and $total is the total number of lines.
$pos
$size
$first
$total
The return value is the same as <FL::Valuator-value();>>
<FL::Valuator-
my $boxtype = $val_a->slider(); $val_b->slider( FL_UP_BOX );
Gets or sets the slider box type.
Set the dimensions of the moving piece of slider.
$val_b->slider_size( .13 );
This is the fraction of the size of the entire widget. If you set this to 1 then the slider cannot move. The default value is .08.
1
.08
For the "fill" sliders this is the size of the area around the end that causes a drag effect rather than causing the slider to jump to the mouse.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sanko Robinson <sanko@cpan.org>
To install Fl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Fl
CPAN shell
perl -MCPAN -e shell install Fl
For more information on module installation, please visit the detailed CPAN module installation guide.