| 1 |
'\" |
| 2 |
'\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies. |
| 3 |
'\" |
| 4 |
'\" Permission to use, copy, modify, and distribute this software and its |
| 5 |
'\" documentation for any purpose and without fee is hereby granted, provided |
| 6 |
'\" that the above copyright notice appear in all copies and that both that the |
| 7 |
'\" copyright notice and warranty disclaimer appear in supporting documentation, |
| 8 |
'\" and that the names of Lucent Technologies any of their entities not be used |
| 9 |
'\" in advertising or publicity pertaining to distribution of the software |
| 10 |
'\" without specific, written prior permission. |
| 11 |
'\" |
| 12 |
'\" Lucent Technologies disclaims all warranties with regard to this software, |
| 13 |
'\" including all implied warranties of merchantability and fitness. In no event |
| 14 |
'\" shall Lucent Technologies be liable for any special, indirect or |
| 15 |
'\" consequential damages or any damages whatsoever resulting from loss of use, |
| 16 |
'\" data or profits, whether in an action of contract, negligence or other |
| 17 |
'\" tortuous action, arising out of or in connection with the use or performance |
| 18 |
'\" of this software. |
| 19 |
'\" |
| 20 |
'\" The table geometry manager created by George Howlett. |
| 21 |
'\" |
| 22 |
.so man.macros |
| 23 |
.TH table n BLT_VERSION BLT "BLT Built-In Commands" |
| 24 |
.BS |
| 25 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 26 |
.SH NAME |
| 27 |
table \- Arranges widgets in a table |
| 28 |
.SH SYNOPSIS |
| 29 |
\fBtable \fIcontainer\fR ?\fIwidget index option value\fR?... |
| 30 |
.sp |
| 31 |
\fBtable arrange\fR \fIcontainer\fR |
| 32 |
.sp |
| 33 |
\fBtable cget \fIcontainer\fR ?\fIitem\fR? \fIoption\fR |
| 34 |
.sp |
| 35 |
\fBtable configure \fIcontainer\fR ?\fIitem\fR?... ?\fIoption value\fR?... |
| 36 |
.sp |
| 37 |
\fBtable extents \fIcontainer\fR \fIitem\fR |
| 38 |
.sp |
| 39 |
\fBtable forget \fIwidget\fR ?\fIwidget\fR?... |
| 40 |
.sp |
| 41 |
\fBtable info \fIcontainer\fR \fIitem\fR |
| 42 |
.sp |
| 43 |
\fBtable locate \fIcontainer\fR \fIx y\fR |
| 44 |
.sp |
| 45 |
\fBtable containers \fR?\fIswitch\fR? ?\fIarg\fR? |
| 46 |
.sp |
| 47 |
\fBtable save \fIcontainer\fR |
| 48 |
.sp |
| 49 |
\fBtable search \fIcontainer\fR ?\fIswitch arg\fR?... |
| 50 |
.BE |
| 51 |
.SH DESCRIPTION |
| 52 |
The \fBtable\fR command arranges widgets in a table. The alignment of |
| 53 |
widgets is detemined by their row and column positions and the number |
| 54 |
of rows or columns that they span. |
| 55 |
.SH INTRODUCTION |
| 56 |
Probably the most painstaking aspect of building a graphical |
| 57 |
application is getting the placement and size of the widgets just right. |
| 58 |
It usually takes many iterations to align widgets and adjust their spacing. |
| 59 |
That's because managing the geometry of widgets is simply not a |
| 60 |
packing problem, but also graphical design problem. Attributes |
| 61 |
such as alignment, symmetry, and balance are more important than |
| 62 |
minimizing the amount of space used for packing. |
| 63 |
.PP |
| 64 |
The \fBtable\fR geometry manager arranges widgets in a table. It's |
| 65 |
easy to align widgets (horizontally and vertically) or to create empty |
| 66 |
space to balance the arrangement of the widgets. Widgets (called |
| 67 |
\fIslaves\fR in the Tk parlance) are arranged inside a containing |
| 68 |
widget (called the \fImaster\fR). Widgets are positioned at |
| 69 |
row,column locations and may span any number of rows or columns. More |
| 70 |
than one widget can occupy a single location. |
| 71 |
.PP |
| 72 |
The placement of widget windows determines both the size and |
| 73 |
arrangement of the table. The table queries the requested size of |
| 74 |
each widget. The \fIrequested size\fR of a widget is the natural size |
| 75 |
of the widget (before the widget is shrunk or expanded). The height |
| 76 |
of each row and the width of each column is the largest widget spanning |
| 77 |
that row or column. The size of the table is in turn the sum of the |
| 78 |
row and column sizes. This is the table's \fInormal size\fR. |
| 79 |
.PP |
| 80 |
The total number of rows and columns in a table is determined from the |
| 81 |
indices specified. The table grows dynamically as windows are added |
| 82 |
at larger indices. |
| 83 |
.SH EXAMPLE |
| 84 |
The table geometry manager is created by invoking the \fBtable\fR command. |
| 85 |
.CS |
| 86 |
# Create a table in the root window |
| 87 |
table . |
| 88 |
.CE |
| 89 |
The window \fB.\fR is now the \fIcontainer\fR of the table. Widgets |
| 90 |
are packed into the table and displayed within the confines of the |
| 91 |
container. |
| 92 |
.PP |
| 93 |
You add widgets to the table by row and column location. Row and |
| 94 |
column indices start from zero. |
| 95 |
.CS |
| 96 |
label .title -text "This is a title" |
| 97 |
|
| 98 |
# Add a label to the table |
| 99 |
table . .title 0,0 |
| 100 |
.CE |
| 101 |
The label \fB.title\fR is added to the table. We can add more widgets |
| 102 |
in the same way. |
| 103 |
.CS |
| 104 |
button .ok -text "Ok" |
| 105 |
button .cancel -text "Cancel" |
| 106 |
|
| 107 |
# Add two buttons |
| 108 |
table . .ok 1,0 |
| 109 |
table . .cancel 1,1 |
| 110 |
.CE |
| 111 |
Two buttons \fB.ok\fR and \fB.cancel\fR are now packed into the second |
| 112 |
row of the table. They each occupy one cell of the table. By |
| 113 |
default, widgets span only a single row and column. |
| 114 |
.PP |
| 115 |
The first column contains two widgets, \fB.title\fR and \fB.ok\fR. By |
| 116 |
default, the widest of the two widgets will define the width of the |
| 117 |
column. However, we want \fB.title\fR to be centered horizontally |
| 118 |
along the top of the table. We can make \fB.title\fR span two columns |
| 119 |
using the \fBconfigure\fR operation. |
| 120 |
.CS |
| 121 |
# Make the label span both columns |
| 122 |
table configure . .title -cspan 2 |
| 123 |
.CE |
| 124 |
The label \fB.title\fR will now be centered along the top row of the |
| 125 |
table. |
| 126 |
.PP |
| 127 |
In the above example, we've create and arranged the layout for the |
| 128 |
table invoking the \fBtable\fR command several times. Alternately, we |
| 129 |
could have used a single \fBtable\fR command. |
| 130 |
.CS |
| 131 |
label .title -text "This is a title" |
| 132 |
button .ok -text "Ok" |
| 133 |
button .cancel -text "Cancel" |
| 134 |
|
| 135 |
# Create and pack the table |
| 136 |
table . \\ |
| 137 |
.title 0,0 -cspan 2 \\ |
| 138 |
.ok 1,0 \\ |
| 139 |
.cancel 1,1 |
| 140 |
.CE |
| 141 |
The table will override the requested width and height of the container |
| 142 |
so that the window fits the table exactly. This also means |
| 143 |
that any change to the size of table will be propagated up through the |
| 144 |
Tk window hierarchy. This feature can be turned off using the |
| 145 |
\fBconfigure\fR operation again. |
| 146 |
.CS |
| 147 |
table configure . -propagate no |
| 148 |
.CE |
| 149 |
You can also set the width of height of the table to a specific |
| 150 |
value. This supersedes the calculated table size. |
| 151 |
.CS |
| 152 |
# Make the container 4 inches wide, 3 inches high |
| 153 |
table configure . -reqwidth 4i -reqheight 3i |
| 154 |
.CE |
| 155 |
If a widget is smaller than the cell(s) it occupies, the widget will |
| 156 |
float within the extra space. By default, the widget will be centered |
| 157 |
within the space, but you can anchor the widget to any side of cell |
| 158 |
using the \fB\-anchor\fR configuration option. |
| 159 |
.CS |
| 160 |
table configure . .ok -anchor w |
| 161 |
.CE |
| 162 |
The \fB\-fill\fR option expands the widget to fill the |
| 163 |
extra space either vertically or horizontally (or both). |
| 164 |
.CS |
| 165 |
# Make the title label fill the entire top row |
| 166 |
table configure . .title -cspan 2 -fill x |
| 167 |
|
| 168 |
# Each button will be as height of the 2nd row. |
| 169 |
table configure . .ok .cancel -fill y |
| 170 |
.CE |
| 171 |
The width of \fB.title\fR will be the combined widths of both columns. |
| 172 |
Both \fB.ok\fR and \fB.cancel\fR will become as tall as the second row. |
| 173 |
.PP |
| 174 |
The \fB\-padx\fR and \fB\-pady\fR options control the amount of padding |
| 175 |
around the widget. Both options take a list of one or two values. |
| 176 |
.CS |
| 177 |
# Pad the title by two pixels above and below. |
| 178 |
table configure . .title -pady 2 |
| 179 |
|
| 180 |
# Pad each button 2 pixels on the left, and 4 on the right. |
| 181 |
table configure . .ok .cancel -padx { 2 4 } |
| 182 |
.CE |
| 183 |
If the list has only one value, then both exterior sides (top and bottom |
| 184 |
or left and right) of the widget are padded by that amount. If the |
| 185 |
list has two elements, the first specifies padding for the top or left |
| 186 |
side and the second for the bottom or right side. |
| 187 |
.PP |
| 188 |
Like the container, you can also override the requested widths and |
| 189 |
heights of widgets using the \fB\-reqwidth\fR and |
| 190 |
\fB\-reqheight\fR options. This is especially useful with |
| 191 |
character-based widgets (such as buttons, labels, text, listbox, etc) |
| 192 |
that let you specify their size only in units of characters and lines, |
| 193 |
instead of pixels. |
| 194 |
.CS |
| 195 |
# Make all buttons one inch wide |
| 196 |
table configure . .ok .cancel -reqwidth 1i |
| 197 |
.CE |
| 198 |
.PP |
| 199 |
Each row and column of the table can be configured, again using the |
| 200 |
\fBconfigure\fR operation. Rows are and columns are designated by |
| 201 |
\fBR\fIi\fR and \fBC\fIi\fR respectively, where \fIi\fR is the index |
| 202 |
of the row or column. |
| 203 |
.PP |
| 204 |
For example, you can set the size of a row or column. |
| 205 |
.CS |
| 206 |
# Make the 1st column 2 inches wide |
| 207 |
table configure . c0 -width 2.0i |
| 208 |
|
| 209 |
# Make the 2nd row 1/2 inch high. |
| 210 |
table configure . r1 -height 0.5i |
| 211 |
.CE |
| 212 |
The new size for the row or column overrides its calculated size. If |
| 213 |
no widgets span the row or column, its height or width is zero. |
| 214 |
So you can use the \fB\-width\fR and \fB\-height\fR options to create |
| 215 |
empty spaces in the table. |
| 216 |
.CS |
| 217 |
# Create an empty row and column |
| 218 |
table configure . r2 c2 -width 1i |
| 219 |
.CE |
| 220 |
The \fB\-pady\fR option lets you add padding to the top and bottom |
| 221 |
sides of rows. The \fB\-padx\fR option adds padding to the left and |
| 222 |
right sides of columns. Both options take a list of one or two |
| 223 |
values. |
| 224 |
.CS |
| 225 |
# Pad above the title by two pixels |
| 226 |
table configure . r0 -pady { 2 0 } |
| 227 |
|
| 228 |
# Pad each column 4 pixels on the left, and 2 on the right. |
| 229 |
table configure . c* -padx { 2 4 } |
| 230 |
.CE |
| 231 |
.PP |
| 232 |
Notice that you can configure all the rows and columns using either |
| 233 |
\fBR*\fR or \fBC*\fR. |
| 234 |
.PP |
| 235 |
When the container is resized, the rows and columns of the table are |
| 236 |
also resized. Only the rows or columns that contain widgets (a widget |
| 237 |
spans the row or column) grow or shrink. The \fB\-resize\fR option |
| 238 |
indicates whether the row or column can be shrunk or stretched. If |
| 239 |
the value is \fBshrink\fR, the row or column can only be resized |
| 240 |
smaller. If \fBexpand\fR, it can only be resized larger. If |
| 241 |
\fBnone\fR, the row or column is frozen at its requested size. |
| 242 |
.CS |
| 243 |
# Let the 1st column get smaller, but not bigger |
| 244 |
table configure . c0 -resize shrink |
| 245 |
|
| 246 |
# Let the 2nd column get bigger, not smaller |
| 247 |
table configure . c1 -resize expand |
| 248 |
|
| 249 |
# Don't resize the first row |
| 250 |
table configure . r0 -resize none |
| 251 |
.CE |
| 252 |
The following example packs a canvas, two scrollbars, and a title. |
| 253 |
The rows and columns containing the scrollbars are frozen at their |
| 254 |
requested size, so that even if the frame is resized, the scrollbars will |
| 255 |
remain the same width. |
| 256 |
.CS |
| 257 |
table . \\ |
| 258 |
.title 0,0 -cspan 3 \\ |
| 259 |
.canvas 1,1 -fill both \\ |
| 260 |
.vscroll 1,2 -fill y \\ |
| 261 |
.hscroll 2,1 -fill x |
| 262 |
|
| 263 |
# Don't let the scrollbars resize |
| 264 |
table configure . c2 r2 -resize none |
| 265 |
|
| 266 |
# Create an empty space to balance the scrollbar |
| 267 |
table configure . c0 -width .vscroll |
| 268 |
.CE |
| 269 |
Note that the value of the \fB\-width\fR option is the name of a widget |
| 270 |
window. This indicates that the width of the column should be the |
| 271 |
same as the requested width of \fB.vscroll\fR. |
| 272 |
.PP |
| 273 |
Finally, the \fBforget\fR operation removes widgets from the table. |
| 274 |
.CS |
| 275 |
# Remove the windows from the table |
| 276 |
table forget .quit .frame |
| 277 |
.CE |
| 278 |
It's not necessary to specify the container. The \fBtable\fR |
| 279 |
command determines the container from the widget name. |
| 280 |
.SH OPERATIONS |
| 281 |
The following operations are available for the \fBtable\fR: |
| 282 |
.TP |
| 283 |
\fBtable \fIcontainer\fR ?\fIwidget index option value\fR?... |
| 284 |
Adds the widget \fIwidget\fR to the table at \fIindex\fR. \fIIndex\fR |
| 285 |
is a row,column position in the table. It must be in the form |
| 286 |
\fIrow\fR,\fIcolumn\fR where \fIrow\fR and \fIcolumn\fR are the |
| 287 |
respective row and column numbers, starting from zero (0,0 is the |
| 288 |
upper leftmost position). \fIRow\fR and \fIcolumn\fR may also be |
| 289 |
numeric expressions that are recursively evaluated. If a table |
| 290 |
doesn't exist for \fIcontainer\fR, one is created. \fIWidget\fR is the |
| 291 |
path name of the window, that must already exist, to be arranged |
| 292 |
inside of \fIcontainer\fR. \fIOption\fR and \fIvalue\fR are described |
| 293 |
in the |
| 294 |
.SB WIDGET OPTIONS |
| 295 |
section. |
| 296 |
.TP |
| 297 |
\fBtable arrange\fR \fIcontainer\fR |
| 298 |
Forces the table to compute its layout immediately. Normally, the |
| 299 |
table geometry manager will wait until the next idle point, before |
| 300 |
calculating the size of its rows and columns. This is useful for |
| 301 |
collecting the \fInormal\fR sizes of rows and columns, that are |
| 302 |
based upon the requested widget sizes. |
| 303 |
.TP |
| 304 |
\fBtable cget\fR \fIcontainer \fR?\fIitem\fR?\fI option\fR |
| 305 |
Returns the current value of the configuration option specific to |
| 306 |
\fIitem\fR given by \fIoption\fR. \fIItem\fR is either a row or |
| 307 |
column index, or the path name of a widget. \fIItem\fR can be |
| 308 |
in any form describe in the \fBconfigure\fR operation below. If no |
| 309 |
\fIitem\fR argument is provided, then the configuration option is |
| 310 |
for the table itself. \fIOption\fR may be any one of the options |
| 311 |
described in the appropiate section for \fIitem\fR. |
| 312 |
.TP |
| 313 |
\fBtable configure\fR \fIcontainer item\fR... ?\fIoption value\fR?... |
| 314 |
Queries or modifies the configuration options specific to \fIitem\fR. |
| 315 |
If no \fIoption\fR is specified, this command returns a list |
| 316 |
describing all of the available options for \fIitem\fR |
| 317 |
If the argument \fIitem\fR is omitted, then the specified |
| 318 |
configuration options are for the table itself. Otherwise |
| 319 |
\fIitem\fR must be either a row or column specification, or the path |
| 320 |
name of a widget. |
| 321 |
The following \fIitem\fR types are available. |
| 322 |
.RS |
| 323 |
.TP |
| 324 |
\fBC\fIi\fR |
| 325 |
Specifies the column of \fIcontainer\fR to be configured. \fIItem\fR |
| 326 |
must be in the form \fBC\fIn\fR, where \fIi\fR is the index of |
| 327 |
the column. See the |
| 328 |
.SB COLUMN OPTIONS |
| 329 |
section. |
| 330 |
.TP |
| 331 |
\fBR\fIi\fR |
| 332 |
Specifies the row of \fIcontainer\fR to be configured. \fIItem\fR must be |
| 333 |
in the form \fBR\fIi\fR, where \fIi\fR is the index of the row. See |
| 334 |
the |
| 335 |
.SB ROW OPTIONS |
| 336 |
section. |
| 337 |
.TP |
| 338 |
\fIwidget\fR |
| 339 |
Specifies a widget of \fIcontainer\fR to be queried. \fIWidget\fR |
| 340 |
is the path name of a widget packed in \fIcontainer\fR. See the |
| 341 |
.SB WIDGET OPTIONS |
| 342 |
section. |
| 343 |
.TP |
| 344 |
No argument |
| 345 |
Specifies that the table itself is to be queried. |
| 346 |
See the |
| 347 |
.SB TABLE OPTIONS |
| 348 |
section for a description of the option-value pairs for the table. |
| 349 |
.RE |
| 350 |
.RS |
| 351 |
.sp |
| 352 |
The \fIoption\fI and \fIvalue\fR pairs are specific to \fIitem\fR. If |
| 353 |
\fIoption\fR is specified with no \fIvalue\fR, then the command |
| 354 |
returns a list describing the one named option (this list will be |
| 355 |
identical to the corresponding sublist of the value returned if no |
| 356 |
\fIoption\fR is specified). If one or more \fIoption\-value\fR pairs |
| 357 |
are specified, then the command modifies the given option(s) to have |
| 358 |
the given value(s); in this case the command returns the empty string. |
| 359 |
.RE |
| 360 |
.TP |
| 361 |
\fBtable extents \fIcontainer\fR \fIindex\fR |
| 362 |
Queries the location and dimensions of row and columns in the table. |
| 363 |
\fIIndex\fR can be either a row or column index or a table index. |
| 364 |
Returns a list of the x,y coordinates (upperleft corner) and |
| 365 |
dimensions (width and height) of the cell, row, or column. |
| 366 |
.TP |
| 367 |
\fBtable forget \fIwidget\fR ?\fIwidget\fR?... |
| 368 |
Requests that \fIwidget\fR no longer have its geometry managed. |
| 369 |
\fIWidget\fR is the pathname of the window currently |
| 370 |
managed by some table. The window will be unmapped so that it no longer |
| 371 |
appears on the screen. If \fIwidget\fR is not currently managed by any table, |
| 372 |
an error message is returned, otherwise the empty string. |
| 373 |
.TP |
| 374 |
\fBtable info \fIcontainer\fR \fIitem\fR |
| 375 |
Returns a list of the current configuration options for \fIitem\fR. |
| 376 |
The list returned is exactly in the form that might be specified to the |
| 377 |
\fBtable\fR command. It can be used to save and reset table |
| 378 |
configurations. \fIItem\fR must be one of the following. |
| 379 |
.RS |
| 380 |
.TP .75i |
| 381 |
\fBC\fIi\fR |
| 382 |
Specifies the column of \fIcontainer\fR to be queried. \fIItem\fR |
| 383 |
must be in the form \fBC\fIn\fR, where \fIn\fR is the index of |
| 384 |
the column. |
| 385 |
.TP |
| 386 |
\fBR\fIi\fR |
| 387 |
Specifies the row of \fIcontainer\fR to be queried. \fIItem\fR must be |
| 388 |
in the form \fBR\fIi\fR, where \fIi\fR is the index of the row. |
| 389 |
.TP |
| 390 |
\fIwidget\fR |
| 391 |
Specifies a widget of \fIcontainer\fR to be queried. |
| 392 |
\fIWidget\fR is the path name of a widget packed in \fIcontainer\fR. |
| 393 |
.TP |
| 394 |
No argument |
| 395 |
Specifies that the table itself is to be queried. |
| 396 |
.RE |
| 397 |
.TP |
| 398 |
\fBtable locate \fIcontainer\fR \fIx y\fR |
| 399 |
Returns the table index (row,column) of the cell containing the given |
| 400 |
screen coordinates. The \fIx\fR and \fIy\fR arguments represent |
| 401 |
the x and y coordinates of the sample point to be tested. |
| 402 |
.TP |
| 403 |
\fBtable containers \fR?\fIswitch arg\fR? |
| 404 |
Returns a list of all container windows matching a given criteria (using |
| 405 |
\fIswitch\fR and \fIarg\fR). If no \fIswitch\fR and \fIarg\fR |
| 406 |
arguments are given, the names of all container windows (only those using |
| 407 |
the \fBtable\fR command) are returned. The following are valid |
| 408 |
switches: |
| 409 |
.RS |
| 410 |
.TP |
| 411 |
\fB\-pattern\fR \fIpattern\fR |
| 412 |
Returns a list of pathnames of all container windows matching \fIpattern\fR. |
| 413 |
.TP |
| 414 |
\fB\-slave\fR \fIwindow\fR |
| 415 |
Returns the name of the container window of table managing \fIwindow\fR. |
| 416 |
\fIWindow\fR must be the path name of widget. If \fIwindow\fR is not |
| 417 |
managed by any table, the empty string is returned. |
| 418 |
.RE |
| 419 |
.TP |
| 420 |
\fBtable search \fIcontainer\fR ?\fIswitch arg\fR?... |
| 421 |
Returns the names of all the widgets in \fIcontainer\fR matching |
| 422 |
the criteria given by \fIswitch\fR and \fIarg\fR. \fIContainer\fR is |
| 423 |
name of the container window associated with the table to be searched. |
| 424 |
The name of the widget is returned if any one |
| 425 |
\fIswitch\fR-\fIarg\fR criteria matches. If no \fIswitch\fR-\fIarg\fR |
| 426 |
arguments are given, the names of all widgets managed by |
| 427 |
\fIcontainer\fR are returned. The following are switches are available: |
| 428 |
.RS |
| 429 |
.TP |
| 430 |
\fB\-pattern\fR \fIpattern\fR |
| 431 |
Returns the names of any names of the widgets matching |
| 432 |
\fIpattern\fR. |
| 433 |
.TP |
| 434 |
\fB\-span\fR \fIindex\fR |
| 435 |
Returns the names of widgets that span \fIindex\fR. A widget |
| 436 |
does not need to start at \fIindex\fR to be included. |
| 437 |
\fIIndex\fR must be in the form \fIrow\fR,\fIcolumn\fR, where |
| 438 |
\fIrow\fR and \fIcolumn\fR are valid row and column numbers. |
| 439 |
.TP |
| 440 |
\fB\-start\fR \fIindex\fR |
| 441 |
Returns the names of widgets that start at \fIindex\fR. |
| 442 |
\fIIndex\fR must be in the form \fIrow\fR,\fIcolumn\fR, where |
| 443 |
\fIrow\fR and \fIcolumn\fR are valid row and column numbers. |
| 444 |
.RE |
| 445 |
.SH TABLE OPTIONS |
| 446 |
To configure the table itself, you omit the \fIitem\fR argument |
| 447 |
when invoking the \fBconfigure\fR operation. |
| 448 |
.CS |
| 449 |
\fBtable configure\fR \fIcontainer\fR ?\fIoption value\fR?... |
| 450 |
.CE |
| 451 |
The following options are available for the table: |
| 452 |
.RS |
| 453 |
.TP |
| 454 |
\fB\-padx \fIpad\fR |
| 455 |
Sets how much padding to add to the left and right exteriors of the table. |
| 456 |
\fIPad\fR can be a list of one or two numbers. If \fIpad\fR |
| 457 |
has two elements, the left side of the table is padded by the first |
| 458 |
value and the right side by the second value. If \fIpad\fR has just |
| 459 |
one value, both the left and right sides are padded evenly by the |
| 460 |
value. The default is \fB0\fR. |
| 461 |
.TP |
| 462 |
\fB\-pady \fIpad\fR |
| 463 |
Sets how much padding to add to the top and bottom exteriors of the table. |
| 464 |
\fIPad\fR can be a list of one or two numbers. If |
| 465 |
\fIpad\fR has two elements, the area above the table is padded by |
| 466 |
the first value and the area below by the second value. If \fIpad\fR |
| 467 |
is just one number, both the top and bottom areas are padded by the |
| 468 |
value. The default is \fB0\fR. |
| 469 |
.TP |
| 470 |
\fB\-propagate \fIboolean\fR |
| 471 |
Indicates if the table should override the requested width and height |
| 472 |
of the \fIcontainer\fR window. If \fIboolean\fR is false, \fIcontainer\fR |
| 473 |
will not be resized. \fIContainer\fR will be its requested size. The |
| 474 |
default is \fB1\fR. |
| 475 |
.RE |
| 476 |
.SH WIDGET OPTIONS |
| 477 |
widgets are configured by specifying the name of the widget |
| 478 |
when invoking the \fBconfigure\fR operation. |
| 479 |
.DS |
| 480 |
\fBtable configure\fR \fIcontainer \fIwidget\fR ?\fIoption value\fR?... |
| 481 |
.DE |
| 482 |
\fIWidget\fR must be the path name of a window already packed in |
| 483 |
the table associated with \fIcontainer\fR. The following options |
| 484 |
are available for widgets: |
| 485 |
.RS |
| 486 |
.TP |
| 487 |
\fB\-anchor \fIanchor\fR |
| 488 |
Anchors \fIwidget\fR to a particular edge of the cell(s) it resides. |
| 489 |
This option has effect only if the space of the spans surrounding |
| 490 |
\fIwidget\fR is larger than \fIwidget\fR. \fIAnchor\fR specifies |
| 491 |
how \fIwidget\fR will be positioned in the space. For example, if |
| 492 |
\fIanchor\fR is \fBcenter\fR then the window is centered in the rows |
| 493 |
and columns it spans; if \fIanchor\fR is \fBw\fR then the window will |
| 494 |
be aligned with the leftmost edge of the span. The default is |
| 495 |
\fBcenter\fR. |
| 496 |
.TP |
| 497 |
\fB\-columnspan \fInumber\fR |
| 498 |
Sets the number of columns \fIwidget\fR will span. |
| 499 |
The default is \fB1\fR. |
| 500 |
.TP |
| 501 |
\fB\-columncontrol \fIcontrol\fR |
| 502 |
Specifies how the width of \fIwidget\fR should control the |
| 503 |
width of the columns it spans. \fIControl\fR is |
| 504 |
either \fBnormal\fR, \fBnone\fR, or \fBfull\fR. |
| 505 |
The default is \fBnormal\fR. |
| 506 |
.RS |
| 507 |
.TP 1i |
| 508 |
\fBnone\fR |
| 509 |
The width of \fIwidget\fR is not considered. |
| 510 |
.TP 1i |
| 511 |
\fBfull\fR |
| 512 |
Only the width of \fIwidget\fR will be considered when computing the |
| 513 |
widths of the columns. |
| 514 |
.TP 1i |
| 515 |
\fBnormal\fR |
| 516 |
Indicates that the widest widget spanning the column will determine |
| 517 |
the width of the span. |
| 518 |
.RE |
| 519 |
.TP |
| 520 |
\fB\-fill \fIfill\fR |
| 521 |
Specifies if \fIwidget\fR should be stretched to fill any free space |
| 522 |
in the span surrounding \fIwidget\fR. \fIFill\fR is either \fBnone\fR, |
| 523 |
\fBx\fR, \fBy\fR, \fBboth\fR. The default is \fBnone\fR. |
| 524 |
.RS |
| 525 |
.TP 1i |
| 526 |
\fBx\fR |
| 527 |
The widget can grow horizontally. |
| 528 |
.TP 1i |
| 529 |
\fBy\fR |
| 530 |
The widget can grow vertically. |
| 531 |
.TP 1i |
| 532 |
\fBboth\fR |
| 533 |
The widget can grow both vertically and horizontally. |
| 534 |
.TP 1i |
| 535 |
\fBnone\fR |
| 536 |
The widget does not grow along with the span. |
| 537 |
.RE |
| 538 |
.TP |
| 539 |
\fB\-ipadx \fIpixels\fR |
| 540 |
Sets how much horizontal padding to add internally on the left and |
| 541 |
right sides of \fIwidget\fR. \fIPixels\fR must be a valid screen distance |
| 542 |
like \fB2\fR or \fB0.3i\fR. The default is \fB0\fR. |
| 543 |
.TP |
| 544 |
\fB\-ipady \fIpixels\fR |
| 545 |
Sets how much vertical padding to add internally on the top and bottom |
| 546 |
of \fIwidget\fR. \fIPixels\fR must be a valid screen distance |
| 547 |
like \fB2\fR or \fB0.3i\fR. The default is \fB0\fR. |
| 548 |
.TP |
| 549 |
\fB\-padx \fIpad\fR |
| 550 |
Sets how much padding to add to the left and right exteriors of \fIwidget\fR. |
| 551 |
\fIPad\fR can be a list of one or two numbers. If \fIpad\fR |
| 552 |
has two elements, the left side of \fIwidget\fR is padded by the first |
| 553 |
value and the right side by the second value. If \fIpad\fR has just |
| 554 |
one value, both the left and right sides are padded evenly by the |
| 555 |
value. The default is \fB0\fR. |
| 556 |
.TP |
| 557 |
\fB\-pady \fIpad\fR |
| 558 |
Sets how much padding to add to the top and bottom exteriors of |
| 559 |
\fIwidget\fR. \fIPad\fR can be a list of one or two numbers. If |
| 560 |
\fIpad\fR has two elements, the area above \fIwidget\fR is padded by |
| 561 |
the first value and the area below by the second value. If \fIpad\fR |
| 562 |
is just one number, both the top and bottom areas are padded by the |
| 563 |
value. The default is \fB0\fR. |
| 564 |
.TP |
| 565 |
\fB\-reqheight \fIheight\fR |
| 566 |
Specifies the limits of the requested height for \fIwidget\fR. |
| 567 |
\fIHeight\fR is a list of bounding values. See the |
| 568 |
.SB BOUNDING SIZES |
| 569 |
section for a description of this list. By default, the height of |
| 570 |
\fIwidget\fR is its requested height with its internal padding |
| 571 |
(see the \fB\-ipady\fR option). The bounds specified by \fIheight\fR |
| 572 |
either override the height completely, or bound the height between two sizes. |
| 573 |
The default is \fB""\fR. |
| 574 |
.TP |
| 575 |
\fB\-reqwidth \fIwidth\fR |
| 576 |
Specifies the limits of the requested width for \fIwidget\fR. |
| 577 |
\fIWidth\fR is a list of bounding values. See the |
| 578 |
.SB BOUNDING SIZES |
| 579 |
section for a description of this list. By default, the width of |
| 580 |
\fIwidget\fR is its requested width with its internal padding |
| 581 |
(set the \fB\-ipadx\fR option). The bounds specified by \fIwidth\fR |
| 582 |
either override the width completely, or bound the height between two sizes. |
| 583 |
The default is \fB""\fR. |
| 584 |
.TP |
| 585 |
\fB\-rowspan \fInumber\fR |
| 586 |
Sets the number of rows \fIwidget\fR will span. The default is \fB1\fR. |
| 587 |
.TP |
| 588 |
\fB\-rowcontrol \fIcontrol\fR |
| 589 |
Specifies how the height of \fIwidget\fR should control the |
| 590 |
height of the rows it spans. \fIControl\fR is |
| 591 |
either \fBnormal\fR, \fBnone\fR, or \fBfull\fR. |
| 592 |
The default is \fBnormal\fR. |
| 593 |
.RS |
| 594 |
.TP 1i |
| 595 |
\fBnone\fR |
| 596 |
The height of \fIwidget\fR is not considered. |
| 597 |
.TP 1i |
| 598 |
\fBfull\fR |
| 599 |
Only the height of \fIwidget\fR will be considered when computing the |
| 600 |
heights of the rows. |
| 601 |
.TP 1i |
| 602 |
\fBnormal\fR |
| 603 |
Indicates that the tallest widget spanning the row will determine |
| 604 |
the height of the span. |
| 605 |
.RE |
| 606 |
.RE |
| 607 |
.SH COLUMN OPTIONS |
| 608 |
To configure a column in the table, specify the column index as |
| 609 |
\fBC\fIi\fR, where \fIi\fR is the index of the column to be |
| 610 |
configured. |
| 611 |
.DS |
| 612 |
\fBtable configure\fR \fIcontainer \fBC\fIi\fR ?\fIoption value\fR?... |
| 613 |
.DE |
| 614 |
If the index is specified as \fBC*\fR, then all columns of the table |
| 615 |
will be configured. The following options are available for table |
| 616 |
columns. |
| 617 |
.RS |
| 618 |
.TP |
| 619 |
\fB\-padx \fIpad\fR |
| 620 |
Sets the padding to the left and right of the column. |
| 621 |
\fIPad\fR can be a list of one or two numbers. If \fIpad\fR has two |
| 622 |
elements, the left side of the column is padded by the first value and |
| 623 |
the right side by the second value. If \fIpad\fR has just one value, |
| 624 |
both the left and right sides are padded evenly by the value. The |
| 625 |
default is \fB0\fR. |
| 626 |
.TP |
| 627 |
\fB\-resize \fImode\fR |
| 628 |
Indicates that the column can expand or shrink from its requested width |
| 629 |
when the table is resized. |
| 630 |
\fIMode\fR must be one of the following: |
| 631 |
\fBnone\fR, \fBexpand\fR, \fBshrink\fR, or \fBboth\fR. If \fImode\fR is |
| 632 |
\fBexpand\fR the width of the column is expanded if there is extra space |
| 633 |
in the container window. If \fImode\fR is \fBshrink\fR its width may be |
| 634 |
reduced beyond its requested width if there is not enough space in the container. |
| 635 |
The default is \fBnone\fR. |
| 636 |
.TP |
| 637 |
\fB\-width \fIwidth\fR |
| 638 |
Specifies the limits within that the width of the column may expand |
| 639 |
or shrink. \fIWidth\fR is a list of bounding values. See the section |
| 640 |
.SB BOUNDING SIZES |
| 641 |
for a description of this list. |
| 642 |
By default there are no constraints. |
| 643 |
.RE |
| 644 |
.SH ROW OPTIONS |
| 645 |
To configure a row in the table, specify the row index as \fBR\fIi\fR, |
| 646 |
where \fIi\fR is the index of the row to be configured. |
| 647 |
.DS |
| 648 |
\fBtable configure\fR \fIcontainer \fBR\fIi\fR ?\fIoption value\fR?... |
| 649 |
.DE |
| 650 |
If the index is specified as \fBR*\fR, then all rows of the table will |
| 651 |
be configured. The following options are available for table rows. |
| 652 |
.RS |
| 653 |
.TP |
| 654 |
\fB\-height \fIheight\fR |
| 655 |
Specifies the limits of the height that the row may expand or shrink to. |
| 656 |
\fIHeight\fR is a list of bounding values. See the section |
| 657 |
.SB BOUNDING SIZES |
| 658 |
for a description of this list. |
| 659 |
By default there are no constraints. |
| 660 |
.TP |
| 661 |
\fB\-pady \fIpad\fR |
| 662 |
Sets the padding above and below the row. \fIPad\fR can be a list |
| 663 |
of one or two numbers. If \fIpad\fR has two elements, the area above |
| 664 |
the row is padded by the first value and the area below by the |
| 665 |
second value. If \fIpad\fR is just one number, both the top and |
| 666 |
bottom areas are padded by the value. The default is \fB0\fR. |
| 667 |
.TP |
| 668 |
\fB\-resize \fImode\fR |
| 669 |
Indicates that the row can expand or shrink from its requested height |
| 670 |
when the table is resized. |
| 671 |
\fIMode\fR must be one of the following: |
| 672 |
\fBnone\fR, \fBexpand\fR, \fBshrink\fR, or \fBboth\fR. If \fImode\fR is |
| 673 |
\fBexpand\fR the height of the row is expanded if there is extra space |
| 674 |
in the container. If \fImode\fR is \fBshrink\fR its height may be |
| 675 |
reduced beyond its requested height if there is not enough space in |
| 676 |
the container. The default is \fBnone\fR. |
| 677 |
.RE |
| 678 |
.SH BOUNDING SIZES |
| 679 |
Sometimes it's more useful to limit resizes to an acceptable range, |
| 680 |
than to fix the size to a particular value or disallow resizing |
| 681 |
altogether. Similar to the way the \fBwm\fR command lets you specify |
| 682 |
a \fBminsize\fR and \fBmaxsize\fR for a toplevel window, you can bound |
| 683 |
the sizes the container, a widget, row, or column may take. |
| 684 |
The \fB\-width\fR, \fB\-height\fR, \fB\-reqwidth\fR, and |
| 685 |
\fB\-reqheight\fR options, take a list of one, two, or three values. |
| 686 |
We can take a previous example and instead preventing resizing, |
| 687 |
bound the size of the scrollbars between two values. |
| 688 |
.CS |
| 689 |
table . \\ |
| 690 |
.title 0,0 -cspan 3 \\ |
| 691 |
.canvas 1,1 -fill both \\ |
| 692 |
.vscroll 1,2 -fill y \\ |
| 693 |
.hscroll 2,1 -fill x |
| 694 |
|
| 695 |
# Bound the scrollbars between 1/8 and 1/2 inch |
| 696 |
table configure . c2 -width { 0.125 0.5 } |
| 697 |
table configure . r2 -height { 0.125 0.5 } |
| 698 |
table configure . vscroll .hscroll -fill both |
| 699 |
.CE |
| 700 |
The scrollbars will get no smaller than 1/8 of an inch, or bigger |
| 701 |
than 1/2 inch. The initial size will be their requested size, |
| 702 |
so long as it is within the specified bounds. |
| 703 |
.PP |
| 704 |
How the elements of the list are interpreted is dependent upon the |
| 705 |
number of elements in the list. |
| 706 |
.RS |
| 707 |
.TP 1i |
| 708 |
{\fI\fR} |
| 709 |
Empty list. No bounds are set. The default sizing is performed. |
| 710 |
.TP |
| 711 |
{\fI x \fR} |
| 712 |
Fixes the size to \fIx\fR. The window or partition cannot grow or |
| 713 |
shrink. |
| 714 |
.TP |
| 715 |
{\fI min max \fR} |
| 716 |
Sets up minimum and maximum limits for the size of the window or |
| 717 |
partition. The window or partition can be reduced less than |
| 718 |
\fImin\fR, nor can it be stretched beyond \fImax\fR. |
| 719 |
.TP |
| 720 |
{\fI min max nom \fR} |
| 721 |
Specifies minimum and maximum size limits, but also specifies a |
| 722 |
nominal size \fInom\fR. This overrides the calculated size of the |
| 723 |
window or partition. |
| 724 |
.RE |
| 725 |
.SH MISCELLANEOUS |
| 726 |
Another feature is that you can put two widgets in the |
| 727 |
same cell of the table. This is useful when you want to add |
| 728 |
decorations around a widget. |
| 729 |
.CS |
| 730 |
frame .frame -bd 1 -relief sunken |
| 731 |
button .quit -text "Quit" |
| 732 |
|
| 733 |
# Put both the frame and the button in the same cell. |
| 734 |
table . \\ |
| 735 |
.quit 1,0 -padx 2 -pady 2 \\ |
| 736 |
.frame 1,0 -fill both |
| 737 |
.CE |
| 738 |
.SH LIMITATIONS |
| 739 |
A long standing bug in Tk (circa 1993), there is no way to detect if a |
| 740 |
window is already a container of a different geometry manager. This |
| 741 |
is usually done by accident, such as the following where all three |
| 742 |
widgets are arranged in the same container ".", but using different |
| 743 |
geometry managers. |
| 744 |
.CS |
| 745 |
table .f1 |
| 746 |
... |
| 747 |
pack .f2 |
| 748 |
... |
| 749 |
grid .f3 |
| 750 |
.CE |
| 751 |
This leads to bizarre window resizing, as each geometry manager |
| 752 |
applies its own brand of layout policies. When the container is a top |
| 753 |
level window (such as "."), your window manager may become locked |
| 754 |
as it responds to the never-ending stream of resize requests. |
| 755 |
.SH KEYWORDS |
| 756 |
frame, geometry manager, location, table, size |
| 757 |
|