NAME
Prima::ScrollBar - scroll bars
DESCRIPTION
Prima::ScrollBar
implements standard vertical and horizontal scrollbars
SYNOPSIS
use Prima::ScrollBar;
my $sb = Prima::ScrollBar->new( owner => $group, %rest_of_profile);
my $sb = $group-> insert( 'ScrollBar', %rest_of_profile);
my $isAutoTrack = $sb-> autoTrack;
$sb-> autoTrack( $yesNo);
my $val = $sb-> value;
$sb-> value( $value);
my $min = $sb-> min;
my $max = $sb-> max;
$sb-> min( $min);
$sb-> max( $max);
$sb-> set_bounds( $min, $max);
my $step = $sb-> step;
my $pageStep = $sb-> pageStep;
$sb-> step( $step);
$sb-> pageStep( $pageStep);
my $partial = $sb-> partial;
my $whole = $sb-> whole;
$sb-> partial( $partial);
$sb-> whole( $whole);
$sb-> set_proportion( $partial, $whole);
my $size = $sb-> minThumbSize;
$sb-> minThumbSize( $size);
my $isVertical = $sb-> vertical;
$sb-> vertical( $yesNo);
my ($width,$height) = $sb-> get_default_size;
API
Properties
- autoTrack BOOLEAN
-
Tells the widget if it should send the
Change
notification during mouse tracking events. Generally, it should only be set to 0 on very slow computers.The default value: 1
- growMode INTEGER
-
The default value is
gm::GrowHiX
, i.e. the scrollbar will try to maintain the constant distance from its right edge to its owner's right edge as the owner changes its size. This is useful for horizontal scrollbars. - height INTEGER
-
The default value is $Prima::ScrollBar::stdMetrics[1], which is an operating system-dependent value determined with a call to
Prima::Application-> get_default_scrollbar_metrics
. The height is affected because by default the horizontalScrollBar
will be created. - max INTEGER
-
Sets the upper limit for
value
.The default value: 100.
- min INTEGER
-
Sets the lower limit for
value
.The default value: 0
- minThumbSize INTEGER
-
A minimal thumb breadth in pixels. The thumb cannot have a main dimension lesser than this.
The default value: 21
- pageStep INTEGER
-
This determines the increment/decrement to
value
during the operations that suppose to scroll by pages, for example clicking the mouse on the strip outside the thumb, or pressingPgDn
orPgUp
.The default value: 10
- partial INTEGER
-
This tells the scrollbar how many imaginary units the thumb should occupy. See
whole
below.The default value: 10
- selectable BOOLEAN
-
The default value is 0. If set to 1 the widget receives keyboard focus; when in focus, the thumb bar is blinking.
- step INTEGER
-
This determines the minimal increment/decrement to
value
during mouse/keyboard interaction.The default value is 1
- value INTEGER
-
A basic scrollbar property; reflects the imaginary position between
min
andmax
, which corresponds directly to the position of the thumb.The default value is 0
- vertical BOOLEAN
-
Determines the main scrollbar style. Set this to 1 when the scrollbar style is vertical, 0 - horizontal. The property can be changed at run-time, so the scrollbars can morph from horizontal to vertical and vice versa.
The default value is 0
- whole INTEGER
-
This tells the scrollbar how many imaginary units correspond to the whole length of the scrollbar. This value has nothing in common with
min
andmax
. You may think of the combination ofpartial
andwhole
as the proportion between the visible size of something (document, for example) and the whole size of that "something".The default value is 100.
Methods
- get_default_size
-
Returns two integers, the default platform-dependant width of a vertical scrollbar and the height of a horizontal scrollbar.
Events
- Change
-
The
Change
notification is sent whenever the thumb position of the scrollbar is changed, subject to certain limitations whenautoTrack
is 0. The notification is sent when appropriate, regardless of whether due to the user interaction or a side effect of some method the programmer has called. - Track
-
If
autoTrack
is 0, called when the user changes the thumb position with the mouse.
EXAMPLE
use Prima;
use Prima::Application name => 'ScrollBar test';
use Prima::ScrollBar;
my $w = Prima::Window->new(
text => 'ScrollBar test',
size => [300,200]);
my $sb = $w-> insert( ScrollBar =>
width => 280,
left => 10,
bottom => 50,
onChange => sub {
$w-> text( $_[0]-> value);
});
run Prima;
SEE ALSO
Prima, Prima::Widget, examples/scrollbar.pl, examples/scrollbar2.pl
AUTHORS
Dmitry Karasik <dk@plab.ku.dk>, Anton Berezin <tobez@plab.ku.dk> - documentation