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 value INTEGER
112 A basic scrollbar property; reflects the imaginary position between
113 "min" and "max", which corresponds directly to the position of the
114 thumb.
115
116 Default value is 0.
117
118 vertical BOOLEAN
119 Determines the main scrollbar style. Set this to 1 when the
120 scrollbar style is vertical, 0 - horizontal. The property can be
121 changed at run-time, so the scrollbars can morph from horizontal to
122 vertical and vice versa.
123
124 Default value is 0 (logical false).
125
126 whole INTEGER
127 This tells the scrollbar how many of imaginary units correspond to
128 the whole length of the scrollbar. This value has nothing in
129 common with "min" and "max". You may think of the combination of
130 "partial" and "whole" as of the proportion between the visible size
131 of something (document, for example) and the whole size of that
132 "something". Useful to struggle against infamous "bird" size of
133 Windows scrollbar thumbs.
134
135 Default value is 100.
136
137 Methods
138 get_default_size
139 Returns two integers, the default platform dependant width of a
140 vertical scrollbar and height of a horizontal scrollbar.
141
142 Events
143 Change
144 The "Change" notification is sent whenever the thumb position of
145 scrollbar is changed, subject to a certain limitations when
146 "autoTrack" is 0. The notification conforms the general Prima rule:
147 it is sent when appropriate, regardless to whether this was a
148 result of user interaction, or a side effect of some method
149 programmer has called.
150
151 Track
152 If "autoTrack" is 0, called when the user changes the thumb
153 position by the mouse instead of "Change".
154
156 use Prima;
157 use Prima::Application name => 'ScrollBar test';
158 use Prima::ScrollBar;
159
160 my $w = Prima::Window-> create(
161 text => 'ScrollBar test',
162 size => [300,200]);
163
164 my $sb = $w-> insert( ScrollBar =>
165 width => 280,
166 left => 10,
167 bottom => 50,
168 onChange => sub {
169 $w-> text( $_[0]-> value);
170 });
171
172 run Prima;
173
175 Prima, Prima::Widget, examples/rtc.pl, examples/scrolbar.pl
176
178 Dmitry Karasik <dk@plab.ku.dk>, Anton Berezin <tobez@plab.ku.dk> -
179 documentation
180
181
182
183perl v5.38.0 2023-07-21 Prima::ScrollBar(3)