Debian Codegraph @

html/table.html

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 <!-- manual page source format generated by PolyglotMan v3.0.8+XFree86, -->
2 <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
3
4 <HTML>
5 <HEAD>
6 <TITLE>table(n) manual page</TITLE>
7 </HEAD>
8 <BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
9 <A HREF="#toc">Table of Contents</A><P>
10
11 <H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
12 table - Arranges widgets in a table
13 <H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
14 <B>table
15 <I>container</I></B> ?<I>widget index option value</I>?... <P>
16 <B>table arrange</B> <I>container</I> <P>
17 <B>table cget
18 <I>container</I></B> ?<I>item</I>? <I>option</I> <P>
19 <B>table configure <I>container</I></B> ?<I>item</I>?... ?<I>option value</I>?...
20 <P>
21 <B>table extents <I>container</I></B> <I>item</I> <P>
22 <B>table forget <I>widget</I></B> ?<I>widget</I>?... <P>
23 <B>table info <I>container</I></B>
24 <I>item</I> <P>
25 <B>table locate <I>container</I></B> <I>x y</I> <P>
26 <B>table containers </B>?<I>switch</I>? ?<I>arg</I>? <P>
27 <B>table save
28 <I>container</I></B> <P>
29 <B>table search <I>container</I></B> ?<I>switch arg</I>?...
30 <H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
31 The <B>table</B> command
•32 arranges widgets in a table. The alignment of widgets is determined by their
33 row and column positions and the number of rows or columns that they span.
34
35 <H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
36 Probably the most painstaking aspect of building a graphical
37 application is getting the placement and size of the widgets just right.
38 It usually takes many iterations to align widgets and adjust their spacing.
39 That's because managing the geometry of widgets is simply not a packing
40 problem, but also graphical design problem. Attributes such as alignment,
41 symmetry, and balance are more important than minimizing the amount of
42 space used for packing. <P>
43 The <B>table</B> geometry manager arranges widgets in a
44 table. It's easy to align widgets (horizontally and vertically) or to create
45 empty space to balance the arrangement of the widgets. Widgets (called
46 <I>slaves</I> in the Tk parlance) are arranged inside a containing widget (called
47 the <I>master</I>). Widgets are positioned at row,column locations and may span
48 any number of rows or columns. More than one widget can occupy a single
49 location. <P>
50 The placement of widget windows determines both the size and arrangement
51 of the table. The table queries the requested size of each widget. The
52 <I>requested size</I> of a widget is the natural size of the widget (before the
53 widget is shrunk or expanded). The height of each row and the width of
54 each column is the largest widget spanning that row or column. The size
55 of the table is in turn the sum of the row and column sizes. This is the
56 table's <I>normal size</I>. <P>
57 The total number of rows and columns in a table is determined
58 from the indices specified. The table grows dynamically as windows are
59 added at larger indices.
60 <H2><A NAME="sect4" HREF="#toc4">Example</A></H2>
61 The table geometry manager is created by
62 invoking the <B>table</B> command. <BR>
63 <CODE># Create a table in the root window<BR>
64 table .<BR>
65 </CODE><P>The window <I>.</I> is now the <I>container</I> of the table. Widgets are packed into
66 the table and displayed within the confines of the container. <P>
67 You add widgets
68 to the table by row and column location. Row and column indices start from
69 zero. <BR>
70 <CODE>label .title -text "This is a title"<BR>
71 <P>
72 # Add a label to the table<BR>
73 table . .title 0,0 <BR>
74 </CODE><P>The label <I>.title</I> is added to the table. We can add more widgets in the same
75 way. <BR>
76 <CODE>button .ok -text "Ok"<BR>
77 button .cancel -text "Cancel"<BR>
78 <P>
79 # Add two buttons<BR>
80 table . .ok 1,0<BR>
81 table . .cancel 1,1<BR>
82 </CODE><P>Two buttons <I>.ok</I> and <I>.cancel</I> are now packed into the second row of the table.
83 They each occupy one cell of the table. By default, widgets span only
84 a single row and column. <P>
85 The first column contains two widgets, <I>.title</I> and
86 <I>.ok</I>. By default, the widest of the two widgets will define the width of
87 the column. However, we want <I>.title</I> to be centered horizontally along the
88 top of the table. We can make <I>.title</I> span two columns using the <B>configure</B>
89 operation. <BR>
90 <CODE># Make the label span both columns<BR>
91 table configure . .title -cspan 2<BR>
92 </CODE><P>The label <I>.title</I> will now be centered along the top row of the table. <P>
93 In
94 the above example, we've create and arranged the layout for the table invoking
95 the <B>table</B> command several times. Alternately, we could have used a single
96 <B>table</B> command. <BR>
97 <CODE>label .title -text "This is a title"<BR>
98 button .ok -text "Ok"<BR>
99 button .cancel -text "Cancel"<BR>
100 <P>
101 # Create and pack the table<BR>
102 table . \<BR>
103 .title 0,0 -cspan 2 \<BR>
104 .ok 1,0 \<BR>
105 .cancel 1,1<BR>
106 </CODE><P>The table will override the requested width and height of the container
107 so that the window fits the table exactly. This also means that any change
108 to the size of table will be propagated up through the Tk window hierarchy.
109 This feature can be turned off using the <B>configure</B> operation again. <BR>
110 <CODE>table configure . -propagate no<BR>
111 </CODE><P>You can also set the width of height of the table to a specific value. This
112 supersedes the calculated table size. <BR>
113 <CODE># Make the container 4 inches wide, 3 inches high<BR>
114 table configure . -reqwidth 4i -reqheight 3i<BR>
115 </CODE><P>If a widget is smaller than the cell(s) it occupies, the widget will float
116 within the extra space. By default, the widget will be centered within
117 the space, but you can anchor the widget to any side of cell using the
118 <B>-anchor</B> configuration option. <BR>
119 <CODE>table configure . .ok -anchor w<BR>
120 </CODE><P>The <B>-fill</B> option expands the widget to fill the extra space either vertically
121 or horizontally (or both). <BR>
122 <CODE># Make the title label fill the entire top row<BR>
123 table configure . .title -cspan 2 -fill x <BR>
124 <P>
125 # Each button will be as height of the 2nd row.<BR>
126 table configure . .ok .cancel -fill y<BR>
127 </CODE><P>The width of <I>.title</I> will be the combined widths of both columns. Both <I>.ok</I>
128 and <I>.cancel</I> will become as tall as the second row. <P>
129 The <B>-padx</B> and <B>-pady</B> options
130 control the amount of padding around the widget. Both options take a list
131 of one or two values. <BR>
132 <CODE># Pad the title by two pixels above and below.<BR>
133 table configure . .title -pady 2<BR>
134 <P>
135 # Pad each button 2 pixels on the left, and 4 on the right.<BR>
136 table configure . .ok .cancel -padx { 2 4 }<BR>
137 </CODE><P>If the list has only one value, then both exterior sides (top and bottom
138 or left and right) of the widget are padded by that amount. If the list
139 has two elements, the first specifies padding for the top or left side
140 and the second for the bottom or right side. <P>
141 Like the container, you can
142 also override the requested widths and heights of widgets using the <B>-reqwidth</B>
143 and <B>-reqheight</B> options. This is especially useful with character-based widgets
144 (such as buttons, labels, text, listbox, etc) that let you specify their
145 size only in units of characters and lines, instead of pixels. <BR>
146 <CODE># Make all buttons one inch wide<BR>
147 table configure . .ok .cancel -reqwidth 1i<BR>
148 <P>
149 </CODE><P>Each row and column of the table can be configured, again using the <B>configure</B>
150 operation. Rows are and columns are designated by <I>R<I>i</I></I> and <I>C<I>i</I></I> respectively,
151 where <I>i</I> is the index of the row or column. <P>
152 For example, you can set the
153 size of a row or column. <BR>
154 <CODE># Make the 1st column 2 inches wide<BR>
155 table configure . c0 -width 2.0i<BR>
156 <P>
157 # Make the 2nd row 1/2 inch high.<BR>
158 table configure . r1 -height 0.5i<BR>
159 </CODE><P>The new size for the row or column overrides its calculated size. If no
160 widgets span the row or column, its height or width is zero. So you can
161 use the <B>-width</B> and <B>-height</B> options to create empty spaces in the table. <BR>
162 <CODE># Create an empty row and column<BR>
163 table configure . r2 c2 -width 1i<BR>
164 </CODE><P>The <B>-pady</B> option lets you add padding to the top and bottom sides of rows.
165 The <B>-padx</B> option adds padding to the left and right sides of columns. Both
166 options take a list of one or two values. <BR>
167 <CODE># Pad above the title by two pixels <BR>
168 table configure . r0 -pady { 2 0 }<BR>
169 <P>
170 # Pad each column 4 pixels on the left, and 2 on the right.<BR>
171 table configure . c* -padx { 2 4 }<BR>
172 <P>
173 </CODE><P>Notice that you can configure all the rows and columns using either <I>R*</I>
174 or <I>C*</I>. <P>
175 When the container is resized, the rows and columns of the table
176 are also resized. Only the rows or columns that contain widgets (a widget
177 spans the row or column) grow or shrink. The <B>-resize</B> option indicates whether
178 the row or column can be shrunk or stretched. If the value is <I>shrink</I>, the
179 row or column can only be resized smaller. If <I>expand</I>, it can only be resized
180 larger. If <I>none</I>, the row or column is frozen at its requested size. <BR>
181 <CODE># Let the 1st column get smaller, but not bigger<BR>
182 table configure . c0 -resize shrink<BR>
183 <P>
184 # Let the 2nd column get bigger, not smaller<BR>
185 table configure . c1 -resize expand<BR>
186 <P>
187 # Don't resize the first row <BR>
188 table configure . r0 -resize none<BR>
189 </CODE><P>The following example packs a canvas, two scrollbars, and a title. The rows
190 and columns containing the scrollbars are frozen at their requested size,
191 so that even if the frame is resized, the scrollbars will remain the same
192 width. <BR>
193 <CODE>table . \<BR>
194 .title 0,0 -cspan 3 \<BR>
195 .canvas 1,1 -fill both \<BR>
196 .vscroll 1,2 -fill y \<BR>
197 .hscroll 2,1 -fill x<BR>
198 <P>
199 # Don't let the scrollbars resize<BR>
200 table configure . c2 r2 -resize none<BR>
201 <P>
202 # Create an empty space to balance the scrollbar<BR>
203 table configure . c0 -width .vscroll<BR>
204 </CODE><P>Note that the value of the <B>-width</B> option is the name of a widget window.
205 This indicates that the width of the column should be the same as the
206 requested width of <I>.vscroll</I>. <P>
207 Finally, the <B>forget</B> operation removes widgets
208 from the table. <BR>
209 <CODE># Remove the windows from the table<BR>
210 table forget .quit .frame<BR>
211 </CODE><P>It's not necessary to specify the container. The <B>table</B> command determines
212 the container from the widget name.
213 <H2><A NAME="sect5" HREF="#toc5">Operations</A></H2>
214 The following operations are
215 available for the <B>table</B>:
216 <DL>
217
218 <DT><B>table <I>container</I></B> ?<I>widget index option value</I>?...
219 </DT>
220 <DD>Adds the widget <I>widget</I> to the table at <I>index</I>. <I>Index</I> is a row,column position
221 in the table. It must be in the form <I>row</I>,<I>column</I> where <I>row</I> and <I>column</I> are
222 the respective row and column numbers, starting from zero (0,0 is the upper
223 leftmost position). <I>Row</I> and <I>column</I> may also be numeric expressions that
224 are recursively evaluated. If a table doesn't exist for <I>container</I>, one is
225 created. <I>Widget</I> is the path name of the window, that must already exist,
226 to be arranged inside of <I>container</I>. <I>Option</I> and <I>value</I> are described in the
227 <FONT SIZE=-1><B>WIDGET</B></FONT>
228 section. </DD>
229
230 <DT><B>table arrange</B> <I>container</I> </DT>
231 <DD>Forces the table to compute its
232 layout immediately. Normally, the table geometry manager will wait until
233 the next idle point, before calculating the size of its rows and columns.
234 This is useful for collecting the <I>normal</I> sizes of rows and columns, that
235 are based upon the requested widget sizes. </DD>
236
237 <DT><B>table cget</B> <I>container </I>?<I>item</I>?<I> option</I>
238 </DT>
239 <DD>Returns the current value of the configuration option specific to <I>item</I>
240 given by <I>option</I>. <I>Item</I> is either a row or column index, or the path name
241 of a widget. <I>Item</I> can be in any form describe in the <B>configure</B> operation
242 below. If no <I>item</I> argument is provided, then the configuration option is
243 for the table itself. <I>Option</I> may be any one of the options described in
•244 the appropriate section for <I>item</I>. </DD>
245
246 <DT><B>table configure</B> <I>container item</I>... ?<I>option
247 value</I>?... </DT>
248 <DD>Queries or modifies the configuration options specific to <I>item</I>.
249 If no <I>option</I> is specified, this command returns a list describing all of
250 the available options for <I>item</I> If the argument <I>item</I> is omitted, then the
251 specified configuration options are for the table itself. Otherwise <I>item</I>
252 must be either a row or column specification, or the path name of a widget.
253 The following <I>item</I> types are available. <blockquote></DD>
254
255 <DT><I>C<I>i</I></I> </DT>
256 <DD>Specifies the column of <I>container</I>
257 to be configured. <I>Item</I> must be in the form <I>C<I>n</I></I>, where <I>i</I> is the index of
258 the column. See the <FONT SIZE=-1><B>COLUMN</B></FONT>
259 section. </DD>
260
261 <DT><I>R<I>i</I></I> </DT>
262 <DD>Specifies the row of <I>container</I>
263 to be configured. <I>Item</I> must be in the form <I>R<I>i</I></I>, where <I>i</I> is the index of the
264 row. See the <FONT SIZE=-1><B>ROW</B></FONT>
265 section. </DD>
266
267 <DT><I>widget</I> </DT>
268 <DD>Specifies a widget of <I>container</I> to be
269 queried. <I>Widget</I> is the path name of a widget packed in <I>container</I>. See the
270 <FONT SIZE=-1><B>WIDGET</B></FONT>
271 section. </DD>
272
273 <DT>No argument </DT>
274 <DD>Specifies that the table itself is to be queried.
275 See the <FONT SIZE=-1><B>TABLE</B></FONT>
276 section for a description of the option-value pairs for
277 the table. </DD>
278 </DL>
279 </blockquote>
280 <blockquote><P>
281 The <I>option<I> and <I>value</I></I></I> pairs are specific to <I>item</I>. If <I>option</I> is
282 specified with no <I>value</I>, then the command returns a list describing the
283 one named option (this list will be identical to the corresponding sublist
284 of the value returned if no <I>option</I> is specified). If one or more <I>option-value</I>
285 pairs are specified, then the command modifies the given option(s) to have
286 the given value(s); in this case the command returns the empty string. </blockquote>
287
288 <DL>
289
290 <DT><B>table
291 extents <I>container</I></B> <I>index</I> </DT>
292 <DD>Queries the location and dimensions of row and
293 columns in the table. <I>Index</I> can be either a row or column index or a table
294 index. Returns a list of the x,y coordinates (upperleft corner) and dimensions
295 (width and height) of the cell, row, or column. </DD>
296
297 <DT><B>table forget <I>widget</I></B> ?<I>widget</I>?...
298 </DT>
299 <DD>Requests that <I>widget</I> no longer have its geometry managed. <I>Widget</I> is the
300 pathname of the window currently managed by some table. The window will
301 be unmapped so that it no longer appears on the screen. If <I>widget</I> is not
302 currently managed by any table, an error message is returned, otherwise
303 the empty string. </DD>
304
305 <DT><B>table info <I>container</I></B> <I>item</I> </DT>
306 <DD>Returns a list of the current
307 configuration options for <I>item</I>. The list returned is exactly in the form
308 that might be specified to the <B>table</B> command. It can be used to save and
309 reset table configurations. <I>Item</I> must be one of the following. <blockquote></DD>
310
311 <DT><I>C<I>i</I></I> </DT>
312 <DD>Specifies
313 the column of <I>container</I> to be queried. <I>Item</I> must be in the form <I>C<I>n</I></I>, where
314 <I>n</I> is the index of the column. </DD>
315
316 <DT><I>R<I>i</I></I> </DT>
317 <DD>Specifies the row of <I>container</I> to be
318 queried. <I>Item</I> must be in the form <I>R<I>i</I></I>, where <I>i</I> is the index of the row.
319 </DD>
320
321 <DT><I>widget</I> </DT>
322 <DD>Specifies a widget of <I>container</I> to be queried. <I>Widget</I> is the path
323 name of a widget packed in <I>container</I>. </DD>
324
325 <DT>No argument </DT>
326 <DD>Specifies that the table
327 itself is to be queried. </DD>
328 </DL>
329 </blockquote>
330
331 <DL>
332
333 <DT><B>table locate <I>container</I></B> <I>x y</I> </DT>
334 <DD>Returns the table index
335 (row,column) of the cell containing the given screen coordinates. The <I>x</I>
336 and <I>y</I> arguments represent the x and y coordinates of the sample point to
337 be tested. </DD>
338
339 <DT><B>table containers </B>?<I>switch arg</I>? </DT>
340 <DD>Returns a list of all container
341 windows matching a given criteria (using <I>switch</I> and <I>arg</I>). If no <I>switch</I>
342 and <I>arg</I> arguments are given, the names of all container windows (only those
343 using the <B>table</B> command) are returned. The following are valid switches:
344 <blockquote></DD>
345
346 <DT><B>-pattern</B> <I>pattern</I> </DT>
347 <DD>Returns a list of pathnames of all container windows matching
348 <I>pattern</I>. </DD>
349
350 <DT><B>-slave</B> <I>window</I> </DT>
351 <DD>Returns the name of the container window of table
352 managing <I>window</I>. <I>Window</I> must be the path name of widget. If <I>window</I> is not
353 managed by any table, the empty string is returned. </DD>
354 </DL>
355 </blockquote>
356
357 <DL>
358
359 <DT><B>table search <I>container</I></B>
360 ?<I>switch arg</I>?... </DT>
361 <DD>Returns the names of all the widgets in <I>container</I> matching
362 the criteria given by <I>switch</I> and <I>arg</I>. <I>Container</I> is name of the container
363 window associated with the table to be searched. The name of the widget
364 is returned if any one <I>switch</I>-<I>arg</I> criteria matches. If no <I>switch</I>-<I>arg</I> arguments
365 are given, the names of all widgets managed by <I>container</I> are returned.
366 The following are switches are available: <blockquote></DD>
367
368 <DT><B>-pattern</B> <I>pattern</I> </DT>
369 <DD>Returns the names
370 of any names of the widgets matching <I>pattern</I>. </DD>
371
372 <DT><B>-span</B> <I>index</I> </DT>
373 <DD>Returns the
374 names of widgets that span <I>index</I>. A widget does not need to start at <I>index</I>
375 to be included. <I>Index</I> must be in the form <I>row</I>,<I>column</I>, where <I>row</I> and <I>column</I>
376 are valid row and column numbers. </DD>
377
378 <DT><B>-start</B> <I>index</I> </DT>
379 <DD>Returns the names of widgets
380 that start at <I>index</I>. <I>Index</I> must be in the form <I>row</I>,<I>column</I>, where <I>row</I> and
381 <I>column</I> are valid row and column numbers. </DD>
382 </DL>
383 </blockquote>
384
385 <H2><A NAME="sect6" HREF="#toc6">Table Options</A></H2>
386 To configure the table
387 itself, you omit the <I>item</I> argument when invoking the <B>configure</B> operation.
388 <BR>
389 <CODE><B>table configure</B> <I>container</I> ?<I>option value</I>?...<BR>
390 </CODE><P>The following options are available for the table: <blockquote>
391 <DL>
392
393 <DT><B>-padx <I>pad</I></B> </DT>
394 <DD>Sets how much
395 padding to add to the left and right exteriors of the table. <I>Pad</I> can be
396 a list of one or two numbers. If <I>pad</I> has two elements, the left side of
397 the table is padded by the first value and the right side by the second
398 value. If <I>pad</I> has just one value, both the left and right sides are padded
399 evenly by the value. The default is <I>0</I>. </DD>
400
401 <DT><B>-pady <I>pad</I></B> </DT>
402 <DD>Sets how much padding to
403 add to the top and bottom exteriors of the table. <I>Pad</I> can be a list of one
404 or two numbers. If <I>pad</I> has two elements, the area above the table is padded
405 by the first value and the area below by the second value. If <I>pad</I> is just
406 one number, both the top and bottom areas are padded by the value. The
407 default is <I>0</I>. </DD>
408
409 <DT><B>-propagate <I>boolean</I></B> </DT>
410 <DD>Indicates if the table should override
411 the requested width and height of the <I>container</I> window. If <I>boolean</I> is false,
412 <I>container</I> will not be resized. <I>Container</I> will be its requested size. The
413 default is <I>1</I>. </DD>
414 </DL>
415 </blockquote>
416
417 <H2><A NAME="sect7" HREF="#toc7">Widget Options</A></H2>
418 widgets are configured by specifying the name
419 of the widget when invoking the <B>configure</B> operation. <BR>
420 <P>
421 <CODE><B>table configure</B> <I>container <I>widget</I></I> ?<I>option value</I>?...<BR>
422 </CODE><P><I>Widget</I> must be the path name of a window already packed in the table associated
423 with <I>container</I>. The following options are available for widgets: <blockquote>
424 <DL>
425
426 <DT><B>-anchor
427 <I>anchor</I></B> </DT>
428 <DD>Anchors <I>widget</I> to a particular edge of the cell(s) it resides. This
429 option has effect only if the space of the spans surrounding <I>widget</I> is
430 larger than <I>widget</I>. <I>Anchor</I> specifies how <I>widget</I> will be positioned in the
431 space. For example, if <I>anchor</I> is <I>center</I> then the window is centered in
432 the rows and columns it spans; if <I>anchor</I> is <I>w</I> then the window will be aligned
433 with the leftmost edge of the span. The default is <I>center</I>. </DD>
434
435 <DT><B>-columnspan <I>number</I></B>
436 </DT>
437 <DD>Sets the number of columns <I>widget</I> will span. The default is <I>1</I>. </DD>
438
439 <DT><B>-columncontrol
440 <I>control</I></B> </DT>
441 <DD>Specifies how the width of <I>widget</I> should control the width of the
442 columns it spans. <I>Control</I> is either <I>normal</I>, <I>none</I>, or <I>full</I>. The default
443 is <I>normal</I>. <blockquote></DD>
444
445 <DT><I>none</I> </DT>
446 <DD>The width of <I>widget</I> is not considered. </DD>
447
448 <DT><I>full</I> </DT>
449 <DD>Only the width
450 of <I>widget</I> will be considered when computing the widths of the columns.
451 </DD>
452
453 <DT><I>normal</I> </DT>
454 <DD>Indicates that the widest widget spanning the column will determine
455 the width of the span. </DD>
456 </DL>
457 </blockquote>
458
459 <DL>
460
461 <DT><B>-fill <I>fill</I></B> </DT>
462 <DD>Specifies if <I>widget</I> should be stretched
463 to fill any free space in the span surrounding <I>widget</I>. <I>Fill</I> is either <I>none</I>,
464 <I>x</I>, <I>y</I>, <I>both</I>. The default is <I>none</I>. <blockquote></DD>
465
466 <DT><I>x</I> </DT>
467 <DD>The widget can grow horizontally. </DD>
468
469 <DT><I>y</I>
470 </DT>
471 <DD>The widget can grow vertically. </DD>
472
473 <DT><I>both</I> </DT>
474 <DD>The widget can grow both vertically
475 and horizontally. </DD>
476
477 <DT><I>none</I> </DT>
478 <DD>The widget does not grow along with the span.
479 </DD>
480 </DL>
481 </blockquote>
482
483 <DL>
484
485 <DT><B>-ipadx <I>pixels</I></B> </DT>
486 <DD>Sets how much horizontal padding to add internally on the
487 left and right sides of <I>widget</I>. <I>Pixels</I> must be a valid screen distance
488 like <I>2</I> or <I>0.3i</I>. The default is <I>0</I>. </DD>
489
490 <DT><B>-ipady <I>pixels</I></B> </DT>
491 <DD>Sets how much vertical padding
492 to add internally on the top and bottom of <I>widget</I>. <I>Pixels</I> must be a valid
493 screen distance like <I>2</I> or <I>0.3i</I>. The default is <I>0</I>. </DD>
494
495 <DT><B>-padx <I>pad</I></B> </DT>
496 <DD>Sets how much
497 padding to add to the left and right exteriors of <I>widget</I>. <I>Pad</I> can be a list
498 of one or two numbers. If <I>pad</I> has two elements, the left side of <I>widget</I>
499 is padded by the first value and the right side by the second value. If
500 <I>pad</I> has just one value, both the left and right sides are padded evenly
501 by the value. The default is <I>0</I>. </DD>
502
503 <DT><B>-pady <I>pad</I></B> </DT>
504 <DD>Sets how much padding to add to
505 the top and bottom exteriors of <I>widget</I>. <I>Pad</I> can be a list of one or two
506 numbers. If <I>pad</I> has two elements, the area above <I>widget</I> is padded by the
507 first value and the area below by the second value. If <I>pad</I> is just one
508 number, both the top and bottom areas are padded by the value. The default
509 is <I>0</I>. </DD>
510
511 <DT><B>-reqheight <I>height</I></B> </DT>
512 <DD>Specifies the limits of the requested height for
513 <I>widget</I>. <I>Height</I> is a list of bounding values. See the <FONT SIZE=-1><B>BOUNDING</B></FONT>
514 section
515 for a description of this list. By default, the height of <I>widget</I> is its
516 requested height with its internal padding (see the <B>-ipady</B> option). The
517 bounds specified by <I>height</I> either override the height completely, or bound
518 the height between two sizes. The default is <I>""</I>. </DD>
519
520 <DT><B>-reqwidth <I>width</I></B> </DT>
521 <DD>Specifies
522 the limits of the requested width for <I>widget</I>. <I>Width</I> is a list of bounding
523 values. See the <FONT SIZE=-1><B>BOUNDING</B></FONT>
524 section for a description of this list. By default,
525 the width of <I>widget</I> is its requested width with its internal padding (set
526 the <B>-ipadx</B> option). The bounds specified by <I>width</I> either override the width
527 completely, or bound the height between two sizes. The default is <I>""</I>. </DD>
528
529 <DT><B>-rowspan
530 <I>number</I></B> </DT>
531 <DD>Sets the number of rows <I>widget</I> will span. The default is <I>1</I>. </DD>
532
533 <DT><B>-rowcontrol
534 <I>control</I></B> </DT>
535 <DD>Specifies how the height of <I>widget</I> should control the height of
536 the rows it spans. <I>Control</I> is either <I>normal</I>, <I>none</I>, or <I>full</I>. The default
537 is <I>normal</I>. <blockquote></DD>
538
539 <DT><I>none</I> </DT>
540 <DD>The height of <I>widget</I> is not considered. </DD>
541
542 <DT><I>full</I> </DT>
543 <DD>Only the
544 height of <I>widget</I> will be considered when computing the heights of the rows.
545 </DD>
546
547 <DT><I>normal</I> </DT>
548 <DD>Indicates that the tallest widget spanning the row will determine
549 the height of the span. </DD>
550 </DL>
551 </blockquote>
552 </blockquote>
553
554 <H2><A NAME="sect8" HREF="#toc8">Column Options</A></H2>
555 To configure a column in the table,
556 specify the column index as <I>C<I>i</I></I>, where <I>i</I> is the index of the column to be
557 configured. <BR>
558 <P>
559 <CODE><B>table configure</B> <I>container <I>C<I>i</I></I></I> ?<I>option value</I>?...<BR>
560 </CODE><P>If the index is specified as <I>C*</I>, then all columns of the table will be
561 configured. The following options are available for table columns. <blockquote>
562 <DL>
563
564 <DT><B>-padx
565 <I>pad</I></B> </DT>
566 <DD>Sets the padding to the left and right of the column. <I>Pad</I> can be a list
567 of one or two numbers. If <I>pad</I> has two elements, the left side of the column
568 is padded by the first value and the right side by the second value. If
569 <I>pad</I> has just one value, both the left and right sides are padded evenly
570 by the value. The default is <I>0</I>. </DD>
571
572 <DT><B>-resize <I>mode</I></B> </DT>
573 <DD>Indicates that the column can
574 expand or shrink from its requested width when the table is resized. <I>Mode</I>
575 must be one of the following: <I>none</I>, <I>expand</I>, <I>shrink</I>, or <I>both</I>. If <I>mode</I> is
576 <I>expand</I> the width of the column is expanded if there is extra space in
577 the container window. If <I>mode</I> is <I>shrink</I> its width may be reduced beyond
578 its requested width if there is not enough space in the container. The default
579 is <I>none</I>. </DD>
580
581 <DT><B>-width <I>width</I></B> </DT>
582 <DD>Specifies the limits within that the width of the column
583 may expand or shrink. <I>Width</I> is a list of bounding values. See the section
584 <FONT SIZE=-1><B>BOUNDING</B></FONT>
585 for a description of this list. By default there are no constraints.
586 </DD>
587 </DL>
588 </blockquote>
589
590 <H2><A NAME="sect9" HREF="#toc9">Row Options</A></H2>
591 To configure a row in the table, specify the row index as <I>R<I>i</I></I>,
592 where <I>i</I> is the index of the row to be configured. <BR>
593 <P>
594 <CODE><B>table configure</B> <I>container <I>R<I>i</I></I></I> ?<I>option value</I>?...<BR>
595 </CODE><P>If the index is specified as <I>R*</I>, then all rows of the table will be configured.
596 The following options are available for table rows. <blockquote>
597 <DL>
598
599 <DT><B>-height <I>height</I></B> </DT>
600 <DD>Specifies
601 the limits of the height that the row may expand or shrink to. <I>Height</I> is
602 a list of bounding values. See the section <FONT SIZE=-1><B>BOUNDING</B></FONT>
603 for a description
604 of this list. By default there are no constraints. </DD>
605
606 <DT><B>-pady <I>pad</I></B> </DT>
607 <DD>Sets the padding
608 above and below the row. <I>Pad</I> can be a list of one or two numbers. If <I>pad</I>
609 has two elements, the area above the row is padded by the first value and
610 the area below by the second value. If <I>pad</I> is just one number, both the
611 top and bottom areas are padded by the value. The default is <I>0</I>. </DD>
612
613 <DT><B>-resize <I>mode</I></B>
614 </DT>
615 <DD>Indicates that the row can expand or shrink from its requested height
616 when the table is resized. <I>Mode</I> must be one of the following: <I>none</I>, <I>expand</I>,
617 <I>shrink</I>, or <I>both</I>. If <I>mode</I> is <I>expand</I> the height of the row is expanded if
618 there is extra space in the container. If <I>mode</I> is <I>shrink</I> its height may
619 be reduced beyond its requested height if there is not enough space in
620 the container. The default is <I>none</I>. </DD>
621 </DL>
622 </blockquote>
623
624 <H2><A NAME="sect10" HREF="#toc10">Bounding Sizes</A></H2>
625 Sometimes it's more useful
626 to limit resizes to an acceptable range, than to fix the size to a particular
627 value or disallow resizing altogether. Similar to the way the <B>wm</B> command
628 lets you specify a <B>minsize</B> and <B>maxsize</B> for a toplevel window, you can bound
629 the sizes the container, a widget, row, or column may take. The <B>-width</B>, <B>-height</B>,
630 <B>-reqwidth</B>, and <B>-reqheight</B> options, take a list of one, two, or three values.
631 We can take a previous example and instead preventing resizing, bound the
632 size of the scrollbars between two values. <BR>
633 <CODE>table . \<BR>
634 .title 0,0 -cspan 3 \<BR>
635 .canvas 1,1 -fill both \<BR>
636 .vscroll 1,2 -fill y \<BR>
637 .hscroll 2,1 -fill x<BR>
638 <P>
639 # Bound the scrollbars between 1/8 and 1/2 inch<BR>
640 table configure . c2 -width { 0.125 0.5 }<BR>
641 table configure . r2 -height { 0.125 0.5 }<BR>
642 table configure . vscroll .hscroll -fill both<BR>
643 </CODE><P>The scrollbars will get no smaller than 1/8 of an inch, or bigger than
644 1/2 inch. The initial size will be their requested size, so long as it
645 is within the specified bounds. <P>
646 How the elements of the list are interpreted
647 is dependent upon the number of elements in the list. <blockquote>
648 <DL>
649
650 <DT>{<I></I>} </DT>
651 <DD>Empty list. No
652 bounds are set. The default sizing is performed. </DD>
653
654 <DT>{<I> x </I>} </DT>
655 <DD>Fixes the size to
656 <I>x</I>. The window or partition cannot grow or shrink. </DD>
657
658 <DT>{<I> min max </I>} </DT>
659 <DD>Sets up minimum
660 and maximum limits for the size of the window or partition. The window
661 or partition can be reduced less than <I>min</I>, nor can it be stretched beyond
662 <I>max</I>. </DD>
663
664 <DT>{<I> min max nom </I>} </DT>
665 <DD>Specifies minimum and maximum size limits, but also
666 specifies a nominal size <I>nom</I>. This overrides the calculated size of the
667 window or partition. </DD>
668 </DL>
669 </blockquote>
670
671 <H2><A NAME="sect11" HREF="#toc11">Miscellaneous</A></H2>
672 Another feature is that you can put two
673 widgets in the same cell of the table. This is useful when you want to
674 add decorations around a widget. <BR>
675 <CODE>frame .frame -bd 1 -relief sunken<BR>
676 button .quit -text "Quit"<BR>
677 <P>
678 # Put both the frame and the button in the same cell.<BR>
679 table . \<BR>
680 .quit 1,0 -padx 2 -pady 2 \<BR>
681 .frame 1,0 -fill both<BR>
682
683 <H2><A NAME="sect12" HREF="#toc12"></CODE><P>Limitations</A></H2>
684 A long standing bug in Tk (circa 1993), there is no way to detect
685 if a window is already a container of a different geometry manager. This
686 is usually done by accident, such as the following where all three widgets
687 are arranged in the same container ".", but using different geometry managers.
688 <BR>
689 <CODE> table .f1<BR>
690 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;...<BR>
691 pack .f2<BR>
692 <tt>&#32;</tt>&nbsp;<tt>&#32;</tt>&nbsp;...<BR>
693 grid .f3<BR>
694 </CODE><P>This leads to bizarre window resizing, as each geometry manager applies
695 its own brand of layout policies. When the container is a top level window
696 (such as "."), your window manager may become locked as it responds to the
697 never-ending stream of resize requests.
698 <H2><A NAME="sect13" HREF="#toc13">Keywords</A></H2>
699 frame, geometry manager,
700 location, table, size <P>
701 <P>
702
703 <HR><P>
704 <A NAME="toc"><B>Table of Contents</B></A><P>
705 <UL>
706 <LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
707 <LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
708 <LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
709 <LI><A NAME="toc3" HREF="#sect3">Introduction</A></LI>
710 <LI><A NAME="toc4" HREF="#sect4">Example</A></LI>
711 <LI><A NAME="toc5" HREF="#sect5">Operations</A></LI>
712 <LI><A NAME="toc6" HREF="#sect6">Table Options</A></LI>
713 <LI><A NAME="toc7" HREF="#sect7">Widget Options</A></LI>
714 <LI><A NAME="toc8" HREF="#sect8">Column Options</A></LI>
715 <LI><A NAME="toc9" HREF="#sect9">Row Options</A></LI>
716 <LI><A NAME="toc10" HREF="#sect10">Bounding Sizes</A></LI>
717 <LI><A NAME="toc11" HREF="#sect11">Miscellaneous</A></LI>
718 <LI><A NAME="toc12" HREF="#sect12">Limitations</A></LI>
719 <LI><A NAME="toc13" HREF="#sect13">Keywords</A></LI>
720 </UL>
721 </BODY></HTML>