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

NAME

Fl::Scrollbar - Slider with Arrow Buttons at Both Ends

Description

The Fl::Scrollbar draws a slider with arrow buttons at the ends of the scrollbar.

Clicking on the arrows move up/left and down/right by linesize(). Scrollbars also accept FL_SHORTCUT events: the arrows move by linesize(), and vertical scrollbars take Page Up/Down (they move by the page size minus linesize()) and Home/End (they jump to the top or bottom).

Scrollbars have step(1) preset (they always return integers). If desired you can set the step() to non-integer values. You will then have to use casts to get at the floating-point versions of value() from Fl::Slider.

Methods

Fl::Scrollbar inherits from Fl::Slider, Fl::Valuator and Fl::Widget. On top of that, it exposes the following methods...

new(...)

    my $val_a = Fl::Scrollbar->new(0, 0, 250, 500, 'Important Stuff');
    my $val_b = Fl::Scrollbar->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.

linesize(...)

    $val_a->linesize( 12 );

This number controls how big the steps are that the arrow keys do.

In addition page up/down move by the size last sent to value() minus one linesize(). The default is 16.

value(...)

    $val_a->value( 12 );
    my $value = $val_b->value();

Gets or sets the value of the slider in the scrollbar.

    $value = $val_b->value( $pos, $windowSize, $first, $total );

Sets the position (first line displayed), size (number of lines displayed), and range of the slider in the scrollbar (number of first and total lines).

You should call this every time your window changes size, your data changes size, or your scroll position changes (even if in response to a callback from this scrollbar). All necessary calls to redraw() are done.

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Sanko Robinson <sanko@cpan.org>