Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "ADJUSTER 1" | |
132 | .TH ADJUSTER 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::Adjuster \- Allow size of packed widgets to be adjusted by user | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | use Tk::Adjuster; | |
138 | .PP | |
139 | \&\fI$adjuster\fR = \fI$widget\fR\->\fBAdjuster\fR\fI(?options?)\fR; | |
140 | .SH "WIDGET-SPECIFIC OPTIONS" | |
141 | .IX Header "WIDGET-SPECIFIC OPTIONS" | |
142 | .IP "Name: \fBrestore\fR" 4 | |
143 | .IX Item "Name: restore" | |
144 | .PD 0 | |
145 | .IP "Class: \fBRestore\fR" 4 | |
146 | .IX Item "Class: Restore" | |
147 | .IP "Switch: \fB\-restore\fR" 4 | |
148 | .IX Item "Switch: -restore" | |
149 | .PD | |
150 | Specifies a boolean value that determines whether the Adjuster | |
151 | should forcibly attempt to make room | |
152 | for itself (by reducing the size of its managed widget) when it is | |
153 | unmapped (for example, due to a size change in a top level window). | |
154 | The default value is 1. | |
155 | .IP "Name: \fBside\fR" 4 | |
156 | .IX Item "Name: side" | |
157 | .PD 0 | |
158 | .IP "Class: \fBSide\fR" 4 | |
159 | .IX Item "Class: Side" | |
160 | .IP "Switch: \fB\-side\fR" 4 | |
161 | .IX Item "Switch: -side" | |
162 | .PD | |
163 | Specifies the side on which the managed widget lies relative to the | |
164 | Adjuster. In conjunction with the pack geometry manager, this relates to | |
165 | the side of the master against which the managed widget and the Adjuster | |
166 | are packed. | |
167 | Must be \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. Defaults to \fBtop\fR. | |
168 | .IP "Name: \fBwidget\fR" 4 | |
169 | .IX Item "Name: widget" | |
170 | .PD 0 | |
171 | .IP "Class: \fBWidget\fR" 4 | |
172 | .IX Item "Class: Widget" | |
173 | .IP "Switch: \fB\-widget\fR" 4 | |
174 | .IX Item "Switch: -widget" | |
175 | .PD | |
176 | Specifies the widget which is to be managed by the Adjuster. | |
177 | .SH "DESCRIPTION" | |
178 | .IX Header "DESCRIPTION" | |
179 | \&\fBTk::Adjuster\fR is a Frame containing a \*(L"line\*(R" and a \*(L"blob\*(R". | |
180 | .PP | |
181 | Dragging with Mouse Button\-1 results in a line being dragged | |
182 | to indicate new size. Releasing Button\-1 submits GeometryRequests | |
183 | on behalf of the managed widget which will cause the packer to change the | |
184 | widget's size. | |
185 | .PP | |
186 | If Drag is done with Shift button down, then GeometryRequests are made | |
187 | in \*(L"real time\*(R" so that text-flow effects can be seen, but as a lot more | |
188 | work is done behaviour may be sluggish. | |
189 | .PP | |
190 | If widget is packed with \-side => left or \-side => right then width is | |
191 | adjusted. If packed \-side => top or \-side => bottom then height is adjusted. | |
192 | .PP | |
193 | \&\fBpackPropagate\fR is turned off for the master window to prevent adjustment | |
194 | changing overall window size. Similarly \fBpackPropagate\fR is turned off | |
195 | for the managed widget if it has things packed inside it. This is so that | |
196 | the GeometryRequests made by \fBTk::Adjuster\fR are not overridden by pack. | |
197 | .PP | |
198 | In addition, the managed widget is made non-expandable | |
199 | to prevent the geometry manager reallocating freed space in the master | |
200 | back to the managed widget. | |
201 | Note however that expansion is turned off only after the Adjuster is mapped, | |
202 | which allows the managed widget to expand naturally on window creation. | |
203 | .PP | |
204 | The Tk::Widget method, \fBpackAdjust\fR, calls pack on the widget, then | |
205 | creates an instance of \fBTk::Adjuster\fR, | |
206 | and packs that \*(L"after\*(R" the widget. Its use has two disadvantages however: the | |
207 | Adjuster widget is not made available to the caller, and | |
208 | options cannot be set on the Adjuster. For these reasons, the Tk::Adjuster | |
209 | method, \fBpackAfter\fR is preferred, but \fBpackAdjust\fR is retained | |
210 | for backwards compatibility. | |
211 | .SH "WIDGET METHODS" | |
212 | .IX Header "WIDGET METHODS" | |
213 | .IP "\fI$adjuster\fR\->\fBpackAfter\fR(\fImanaged_widget, ?pack_options?\fR)" 4 | |
214 | .IX Item "$adjuster->packAfter(managed_widget, ?pack_options?)" | |
215 | This command configures the Adjuster's \fB\-widget\fR and \fB\-side\fR options | |
216 | respectively to \fImanaged_widget\fR and the \fB\-side\fR value specified in | |
217 | \&\fIpack_options\fR (\fBtop\fR if not specified). It then packs the Adjuster | |
218 | after \fImanaged_widget\fR, with \fB\-fill\fR set to \fBx\fR or \fBy\fR as appropriate. | |
219 | .IP "\fI$adjuster\fR\->\fBpackForget\fR\fI?(boolean)?\fR" 4 | |
220 | .IX Item "$adjuster->packForget?(boolean)?" | |
221 | This command calls \fBTk::Widget::packForget\fR on the Adjuster. | |
222 | If a parameter is provided and it has a true boolean value, then | |
223 | \&\fBpackForget\fR is also called on the managed widget. | |
224 | .IP "\fI$adjuster\fR\->\fBslave\fR" 4 | |
225 | .IX Item "$adjuster->slave" | |
226 | This command returns the value \fI$adjuster\fR\->\fIcget('\-widget')\fR, ie. the | |
227 | reference to the managed widget. | |
228 | .SH "EXAMPLES" | |
229 | .IX Header "EXAMPLES" | |
230 | \&\fBUsing an Adjuster to separate two widgets, whereby the left widget | |
231 | is managed, and right widget expands to fill space on a window resize\fR | |
232 | .PP | |
233 | a) Using packAfter (preferred interface) | |
234 | .PP | |
235 | .Vb 2 | |
236 | \& use Tk; | |
237 | \& use Tk::Adjuster; | |
238 | .Ve | |
239 | .PP | |
240 | .Vb 4 | |
241 | \& my $f = MainWindow->new; | |
242 | \& my $lst1 = $f->Listbox(); | |
243 | \& my $adj1 = $f->Adjuster(); | |
244 | \& my $lst2 = $f->Listbox(); | |
245 | .Ve | |
246 | .PP | |
247 | .Vb 5 | |
248 | \& my $side = 'left'; | |
249 | \& $lst1->pack(-side => $side, -fill => 'both', -expand => 1); | |
250 | \& $adj1->packAfter($lst1, -side => $side); | |
251 | \& $lst2->pack(-side => $side, -fill => 'both', -expand => 1); | |
252 | \& MainLoop; | |
253 | .Ve | |
254 | .PP | |
255 | b) Using packAdjust | |
256 | .PP | |
257 | .Vb 2 | |
258 | \& use Tk; | |
259 | \& use Tk::Adjuster; | |
260 | .Ve | |
261 | .PP | |
262 | .Vb 3 | |
263 | \& my $f = MainWindow->new; | |
264 | \& my $lst1 = $f->Listbox(); | |
265 | \& my $lst2 = $f->Listbox(); | |
266 | .Ve | |
267 | .PP | |
268 | .Vb 4 | |
269 | \& my $side = 'left'; | |
270 | \& $lst1->packAdjust(-side => $side, -fill => 'both'); | |
271 | \& $lst2->pack (-side => $side, -fill => 'both', -expand => 1); | |
272 | \& MainLoop; | |
273 | .Ve | |
274 | .PP | |
275 | c) Using the standard Tk::Widget::pack | |
276 | .PP | |
277 | .Vb 2 | |
278 | \& use Tk; | |
279 | \& use Tk::Adjuster; | |
280 | .Ve | |
281 | .PP | |
282 | .Vb 5 | |
283 | \& my $f = MainWindow->new; | |
284 | \& my $side = 'left'; | |
285 | \& my $lst1 = $f->Listbox(); | |
286 | \& my $adj = $f->Adjuster(-widget => $lst1, -side => $side); | |
287 | \& my $lst2 = $f->Listbox(); | |
288 | .Ve | |
289 | .PP | |
290 | .Vb 3 | |
291 | \& $lst1->pack(-side => $side, -fill => 'both', -expand => 1); | |
292 | \& $adj->pack (-side => $side, -fill => 'y'); | |
293 | \& $lst2->pack(-side => $side, -fill => 'both', -expand => 1); | |
294 | .Ve | |
295 | .PP | |
296 | .Vb 1 | |
297 | \& MainLoop; | |
298 | .Ve | |
299 | .PP | |
300 | Changing the above examples so that \f(CW$side\fR has the value 'right' means the | |
301 | left widget expands to fill space on a window resize. | |
302 | .PP | |
303 | Changing the above examples so that \f(CW$side\fR has the value 'top' | |
304 | produces a testcase with a horizontal Adjuster. | |
305 | Here the bottom widget expands to fill space on a window resize. | |
306 | Packing to the 'bottom' makes the top widget expand to fill space on window | |
307 | resize. | |
308 | .PP | |
309 | \&\fBUsing \-restore => 0 for multiple columns\fR | |
310 | .PP | |
311 | In the case of multiple columns (or rows) the \*(L"restore\*(R" functionality of the | |
312 | Adjuster can be inconvenient. When the user adjusts the width of one column | |
313 | and thereby pushes the Adjuster of another column off the window, this | |
314 | adjuster tries to restore itself by reducing the size of its managed widget. | |
315 | This has the effect that column widths shrink; and the original size | |
316 | is not restored when | |
317 | the user reverses the originating change. The \fB\-restore\fR option can be | |
318 | used to turn off this functionality. (It makes some sense, however, to | |
319 | leave \fB\-restore\fR | |
320 | turned on for the first-packed Adjuster, so that at least one Adjuster | |
321 | always remains visible.) | |
322 | .PP | |
323 | .Vb 8 | |
324 | \& use Tk; | |
325 | \& use Tk::Adjuster; | |
326 | \& my $f = MainWindow->new; | |
327 | \& my $lst1 = $f->Listbox(); | |
328 | \& my $adj1 = $f->Adjuster(); | |
329 | \& my $lst2 = $f->Listbox(); | |
330 | \& my $adj2 = $f->Adjuster(-restore => 0); | |
331 | \& my $lst3 = $f->Listbox(); | |
332 | .Ve | |
333 | .PP | |
334 | .Vb 6 | |
335 | \& my $side = 'left'; | |
336 | \& $lst1->pack(-side => $side, -fill => 'both', -expand => 1); | |
337 | \& $adj1->packAfter($lst1, -side => $side); | |
338 | \& $lst2->pack(-side => $side, -fill => 'both', -expand => 1); | |
339 | \& $adj2->packAfter($lst2, -side => $side); | |
340 | \& $lst3->pack(-side => $side, -fill => 'both', -expand => 1); | |
341 | .Ve | |
342 | .PP | |
343 | .Vb 1 | |
344 | \& MainLoop; | |
345 | .Ve | |
346 | .SH "BUGS" | |
347 | .IX Header "BUGS" | |
348 | It is currently not possible to configure the appearance of the Adjuster. | |
349 | It would be nice to be able to set the width and relief of the Adjuster \*(L"line\*(R" | |
350 | and the presence/absence of the \*(L"blob\*(R" on the Adjuster. | |
351 | .PP | |
352 | Tk::Adjuster works theoretically with the grid geometry manager but there | |
353 | are currently some problems which seem to be due to bugs in grid: | |
354 | .PP | |
355 | .Vb 6 | |
356 | \& a) There's never an Unmap event for the adjuster, so the "restore" | |
357 | \& functionality has no effect. | |
358 | \& b) After adjusting, widgets protrude into the border of the master. | |
359 | \& c) grid('Propagate', 0) on MainWindow has no effect - window shrinks/grows | |
360 | \& when widgets are adjusted. | |
361 | \& d) Widgets shuffle to correct position on startup | |
362 | .Ve |