-
-
-
This increases the columnspan of the slave to the left. Several
-'s in a row will successively increase the columnspan. A -
may not follow a ^ or a x.
-
x
-
This leaves an empty column between the slave on the left and
the slave on the right.
-
^
-
This extends the rowspan of the slave above the ^'s
in the grid. The number of ^'s in a row must match the number of
columns spanned by the slave above it.
THE GRID ALGORITHM
The grid geometry manager lays out its slaves in three steps.
In the first step, the minimum size needed to fit all of the slaves
is computed, then (if propagation is turned on), a request is made
of the master window to become that size.
In the second step, the requested size is compared against the actual size
of the master. If the sizes are different, then spaces is added to or taken
away from the layout as needed.
For the final step, each slave is positioned in its row(s) and column(s)
based on the setting of its sticky flag.
To compute the minimum size of a layout, the grid geometry manager
first looks at all slaves whose columnspan and rowspan values are one,
and computes the nominal size of each row or column to be either the
minsize for that row or column, or the sum of the padding
plus the size of the largest slave, whichever is greater. Then the
slaves whose rowspans or columnspans are greater than one are
examined. If a group of rows or columns need to be increased in size
in order to accommodate these slaves, then extra space is added to each
row or column in the group according to its weight. For each
group whose weights are all zero, the additional space is apportioned
equally.
For masters whose size is larger than the requested layout, the additional
space is apportioned according to the row and column weights. If all of
the weights are zero, the layout is centered within its master.
For masters whose size is smaller than the requested layout, space is taken
away from columns and rows according to their weights. However, once a
column or row shrinks to its minsize, its weight is taken to be zero.
If more space needs to be removed from a layout than would be permitted, as
when all the rows or columns are at there minimum sizes, the layout is
clipped on the bottom and right.
GEOMETRY PROPAGATION
The grid geometry manager normally computes how large a master must be to
just exactly meet the needs of its slaves, and it sets the
requested width and height of the master to these dimensions.
This causes geometry information to propagate up through a
window hierarchy to a top-level window so that the entire
sub-tree sizes itself to fit the needs of the leaf windows.
However, the grid propagate command may be used to
turn off propagation for one or more masters.
If propagation is disabled then grid will not set
the requested width and height of the master window.
This may be useful if, for example, you wish for a master
window to have a fixed size that you specify.
RESTRICTIONS ON MASTER WINDOWS
The master for each slave must either be the slave's parent
(the default) or a descendant of the slave's parent.
This restriction is necessary to guarantee that the
slave can be placed over any part of its master that is
visible without danger of the slave being clipped by its parent.
In addition, all slaves in one call to grid must have the same master.
STACKING ORDER
If the master for a slave is not its parent then you must make sure
that the slave is higher in the stacking order than the master.
Otherwise the master will obscure the slave and it will appear as
if the slave hasn't been managed correctly.
The easiest way to make sure the slave is higher than the master is
to create the master window first: the most recently created window
will be highest in the stacking order.
CREDITS
The grid command is based on ideas taken from the GridBag
geometry manager written by Doug. Stein, and the blt_table geometry
manager, written by George Howlett.
KEYWORDS
geometry manager, location, grid, cell, propagation, size, pack
Last change: 4.1
[ tcl8.0a1 | tk8.0a1 | X-ref ]
Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.