1Prima::ScrollBar(3) User Contributed Perl Documentation Prima::ScrollBar(3)
2
3
4
6 Prima::ScrollBar - standard scroll bars class
7
9 The class "Prima::ScrollBar" implements both vertical and horizontal
10 scrollbars in Prima. This is a purely Perl class without any
11 C-implemented parts except those inherited from "Prima::Widget".
12
14 use Prima::ScrollBar;
15
16 my $sb = Prima::ScrollBar-> create( owner => $group, %rest_of_profile);
17 my $sb = $group-> insert( 'ScrollBar', %rest_of_profile);
18
19 my $isAutoTrack = $sb-> autoTrack;
20 $sb-> autoTrack( $yesNo);
21
22 my $val = $sb-> value;
23 $sb-> value( $value);
24
25 my $min = $sb-> min;
26 my $max = $sb-> max;
27 $sb-> min( $min);
28 $sb-> max( $max);
29 $sb-> set_bounds( $min, $max);
30
31 my $step = $sb-> step;
32 my $pageStep = $sb-> pageStep;
33 $sb-> step( $step);
34 $sb-> pageStep( $pageStep);
35
36 my $partial = $sb-> partial;
37 my $whole = $sb-> whole;
38 $sb-> partial( $partial);
39 $sb-> whole( $whole);
40 $sb-> set_proportion( $partial, $whole);
41
42 my $size = $sb-> minThumbSize;
43 $sb-> minThumbSize( $size);
44
45 my $isVertical = $sb-> vertical;
46 $sb-> vertical( $yesNo);
47
48 my ($width,$height) = $sb-> get_default_size;
49
51 Properties
52 autoTrack BOOLEAN
53 Tells the widget if it should send "Change" notification during
54 mouse tracking events. Generally it should only be set to 0 on
55 very slow computers.
56
57 Default value is 1 (logical true).
58
59 growMode INTEGER
60 Default value is gm::GrowHiX, i.e. the scrollbar will try to
61 maintain the constant distance from its right edge to its owner's
62 right edge as the owner changes its size. This is useful for
63 horizontal scrollbars.
64
65 height INTEGER
66 Default value is $Prima::ScrollBar::stdMetrics[1], which is an
67 operating system dependent value determined with a call to
68 "Prima::Application-> get_default_scrollbar_metrics". The height
69 is affected because by default the horizontal "ScrollBar" will be
70 created.
71
72 max INTEGER
73 Sets the upper limit for "value".
74
75 Default value: 100.
76
77 min INTEGER
78 Sets the lower limit for "value".
79
80 Default value: 0
81
82 minThumbSize INTEGER
83 A minimal thumb breadth in pixels. The thumb cannot have main
84 dimension lesser than this.
85
86 Default value: 21
87
88 pageStep INTEGER
89 This determines the increment/decrement to "value" during
90 "page"-related operations, for example clicking the mouse on the
91 strip outside the thumb, or pressing "PgDn" or "PgUp".
92
93 Default value: 10
94
95 partial INTEGER
96 This tells the scrollbar how many of imaginary units the thumb
97 should occupy. See "whole" below.
98
99 Default value: 10
100
101 selectable BOOLEAN
102 Default value is 0 (logical false). If set to 1 the widget
103 receives keyboard focus; when in focus, the thumb is blinking.
104
105 step INTEGER
106 This determines the minimal increment/decrement to "value" during
107 mouse/keyboard interaction.
108
109 Default value is 1.
110
111 style STRING = [ 'xp' | 'os2 ]
112 Defines the scrollbar drawing style, that was historically
113 different on windows and the other platforms. It is possible to
114 define own styles.
115
116 value INTEGER
117 A basic scrollbar property; reflects the imaginary position between
118 "min" and "max", which corresponds directly to the position of the
119 thumb.
120
121 Default value is 0.
122
123 vertical BOOLEAN
124 Determines the main scrollbar style. Set this to 1 when the
125 scrollbar style is vertical, 0 - horizontal. The property can be
126 changed at run-time, so the scrollbars can morph from horizontal to
127 vertical and vice versa.
128
129 Default value is 0 (logical false).
130
131 whole INTEGER
132 This tells the scrollbar how many of imaginary units correspond to
133 the whole length of the scrollbar. This value has nothing in
134 common with "min" and "max". You may think of the combination of
135 "partial" and "whole" as of the proportion between the visible size
136 of something (document, for example) and the whole size of that
137 "something". Useful to struggle against infamous "bird" size of
138 Windows scrollbar thumbs.
139
140 Default value is 100.
141
142 Methods
143 get_default_size
144 Returns two integers, the default platform dependant width of a
145 vertical scrollbar and height of a horizontal scrollbar.
146
147 Events
148 Change
149 The "Change" notification is sent whenever the thumb position of
150 scrollbar is changed, subject to a certain limitations when
151 "autoTrack" is 0. The notification conforms the general Prima rule:
152 it is sent when appropriate, regardless to whether this was a
153 result of user interaction, or a side effect of some method
154 programmer has called.
155
156 Track
157 If "autoTrack" is 0, called when the user changes the thumb
158 position by the mouse instead of "Change".
159
161 use Prima;
162 use Prima::Application name => 'ScrollBar test';
163 use Prima::ScrollBar;
164
165 my $w = Prima::Window-> create(
166 text => 'ScrollBar test',
167 size => [300,200]);
168
169 my $sb = $w-> insert( ScrollBar =>
170 width => 280,
171 left => 10,
172 bottom => 50,
173 onChange => sub {
174 $w-> text( $_[0]-> value);
175 });
176
177 run Prima;
178
180 Prima, Prima::Widget, Prima::IntUtils, examples/rtc.pl,
181 examples/scrolbar.pl
182
184 Dmitry Karasik <dk@plab.ku.dk>, Anton Berezin <tobez@plab.ku.dk> -
185 documentation
186
187
188
189perl v5.32.0 2020-07-28 Prima::ScrollBar(3)