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

NAME

FLTK::Scrollbar - Controls an integer position of a window of a given size inside a data set of a given total size

Description

The Scrollbar widget displays a slider with arrow buttons at the ends of the scrollbar. Clicking on the arrows move up/left and down/right by linesize( ). If the scrollbar has the keyboard focus 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). Often a widget that takes focus such as the browser will just send keystrokes to the scrollbar directly to get it to move in response.

Functions

default_style

my $style = $scrollbar->default_style( );
$scrollbar->default_style( $new_style );

new

my $self = $scrollbar->new( $x, $y, $w, $h, $label );

Creates a new FLTK::Scrollbar widget.

pagesize

my $size = $scrollbar->pagesize( );
$scrollbar->pagesize( $size );

How much the pageup/down keys and clicking in the empty area move by. If you call value( ) this is set to 1 linesize( ) less than the window.

value

my $value = $scrollbar->value( );

Return the current position of the scrollbar as an integer.

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 the Slider base class.

my $set = $scrollbar->value( $position );

Set the current position of the scrollbar.

my $set = $scrollbar->value( $position, $size, $top, $total );

Set the current position, the range, the pagesize, and the slider_size( ) all at once in a useful way.

Parameters include...

  • position is the position in the data of the first pixel in the window

  • size is the size of the window

  • top is the position of the top of your data (typically zero)

  • total is the total size of your data

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.