| Prima documentation | view source | Contained in the Prima distribution. |
Prima::ScrollBar - standard scroll bars class
The class Prima::ScrollBar implements both vertical and horizontal
scrollbars in Prima. This is a purely Perl class without any
C-implemented parts except those inherited from Prima::Widget.
use Prima::ScrollBar; my $sb = Prima::ScrollBar-> create( 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;
Tells the widget if it should send
Change notification during mouse tracking events.
Generally it should only be set to 0 on very slow computers.
Default value is 1 (logical true).
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.
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 horizontal ScrollBar will be
created.
Sets the upper limit for value.
Default value: 100.
Sets the lower limit for value.
Default value: 0
A minimal thumb breadth in pixels. The thumb cannot have main dimension lesser than this.
Default value: 21
This determines the increment/decrement to
value during "page"-related operations, for example clicking the mouse
on the strip outside the thumb, or pressing PgDn or PgUp.
Default value: 10
This tells the scrollbar how many of imaginary
units the thumb should occupy. See whole below.
Default value: 10
Default value is 0 (logical false). If set to 1 the widget receives keyboard focus; when in focus, the thumb is blinking.
This determines the minimal increment/decrement to value during
mouse/keyboard interaction.
Default value is 1.
A basic scrollbar property; reflects the imaginary position between min and
max, which corresponds directly to the position of the thumb.
Default value is 0.
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.
Default value is 0 (logical false).
This tells the scrollbar how many of imaginary units correspond to the whole
length of the scrollbar. This value has nothing in common with min and
max. You may think of the combination of partial and whole as of the
proportion between the visible size of something (document, for example) and
the whole size of that "something". Useful to struggle against infamous "bird"
size of Windows scrollbar thumbs.
Default value is 100.
Returns two integers, the default platform dependant width of a vertical scrollbar and height of a horizontal scrollbar.
The Change notification is sent whenever the thumb position of scrollbar is
changed, subject to a certain limitations when autoTrack is 0. The
notification conforms the general Prima rule: it is sent when appropriate,
regardless to whether this was a result of user interaction, or a side effect
of some method programmer has called.
If autoTrack is 0, called when the user changes the thumb position by the
mouse instead of Change.
use Prima;
use Prima::Application name => 'ScrollBar test';
use Prima::ScrollBar;
my $w = Prima::Window-> create(
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;
Prima, Prima::Widget, Prima::IntUtils, examples/rtc.pl, examples/scrolbar.pl
Dmitry Karasik <dk@plab.ku.dk>, Anton Berezin <tobez@plab.ku.dk> - documentation
| Prima documentation | view source | Contained in the Prima distribution. |