Commit of 3.99.0 version
This commit is contained in:
+145
-62
@@ -1,4 +1,5 @@
|
||||
<HTML><HEAD><TITLE>Tk Built-In Commands - grid manual page</TITLE></HEAD>
|
||||
<BR>
|
||||
<BODY bgcolor = #c3c3ff>
|
||||
<H2><IMG ALIGN=BOTTOM SRC="./Img/ManPageBlue.gif"> grid</H2>
|
||||
<I>Geometry manager that arranges widgets in a grid</I><P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
|
||||
@@ -17,24 +18,44 @@ If the first argument to <B>grid</B> is a window name (any value
|
||||
starting with ``.''), then the procedure is processed in the same
|
||||
way as <B>grid configure</B>.
|
||||
<P>
|
||||
<DT><A NAME="M5">(<B>grid 'bbox </B><I>master column row</I>)</A><DD>
|
||||
The bounding box (in pixels) is returned for the space occupied by
|
||||
the grid position indicated by <I>column</I> and <I>row</I>. The
|
||||
return value consists of 4 integers. The first two are the pixel offset
|
||||
from the master window (x then y) of the top-left corner of the grid
|
||||
cell, and the second two are the width and height of the cell.
|
||||
<DT><A NAME="M5">(<B>grid 'bbox </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M6">(<B>grid 'bbox </B><I>master column row</I>)</A><DD>
|
||||
<DT><A NAME="M7">(<B>grid 'bbox </B><I>master column row column2 row2</I>)</A><DD>
|
||||
With no arguments,
|
||||
the bounding box (in pixels) of the grid is returned.
|
||||
The return value consists of 4 integers. The first two are the pixel
|
||||
offset from the master window (x then y) of the top-left corner of the
|
||||
grid, and the second two integers are the width and height of the grid,
|
||||
also in pixels. If a single <I>column</I> and <I>row</I> is specified on
|
||||
the command line, then the bounding box for that cell is returned, where the
|
||||
top left cell is numbered from zero. If both <I>column</I> and <I>row</I>
|
||||
arguments are specified, then the bounding box spanning the rows and columns
|
||||
indicated is returned.
|
||||
<P>
|
||||
<DT><A NAME="M6">(<B>grid 'columnconfigure </B><I>master index </I>?<I>:option value...</I>?)</A><DD>
|
||||
<DT><A NAME="M8">(<B>grid 'columnconfigure </B><I>master index </I>?<I>:option value...</I>?)</A><DD>
|
||||
Query or set the column properties of the <I>index</I> column of the
|
||||
geometry master, <I>master</I>.
|
||||
The valid options are <B>:minsize</B> and <B>:weight</B>.
|
||||
The <B>:minsize</B> option sets the minimum column size, in screen units,
|
||||
and the <B>:weight</B> option (a floating point value)
|
||||
The valid options are <B>:minsize</B>, <B>:weight</B> and <B>:pad</B>.
|
||||
If one or more options are provided, then <I>index</I> may be given as
|
||||
a list of column indexes to which the configuration options will operate on.
|
||||
The <B>:minsize</B> option sets the minimum size, in screen units,
|
||||
that will be permitted for this column.
|
||||
The <B>:weight</B> option (an integer value)
|
||||
sets the relative weight for apportioning
|
||||
any extra spaces among
|
||||
columns. If no value is specified, the current value is returned.
|
||||
columns.
|
||||
A weight of zero (0) indicates the column will not deviate from its requested
|
||||
size. A column whose weight is two will grow at twice the rate as a column
|
||||
of weight one when extra space is allocated to the layout.
|
||||
The <B>:pad</B> option specifies the number of screen units that will be
|
||||
added to the largest window contained completely in that column when the
|
||||
grid geometry manager requests a size from the containing window.
|
||||
If only an option is specified, with no value,
|
||||
the current value of that option is returned.
|
||||
If only the master window and index is specified, all the current settings
|
||||
are returned in an list of ":option value" pairs.
|
||||
<P>
|
||||
<DT><A NAME="M7">(<B>grid 'configure </B><I>slave </I>?<I>slave ...</I>? ?<I>options</I>?)</A><DD>
|
||||
<DT><A NAME="M9">(<B>grid 'configure </B><I>slave </I>?<I>slave ...</I>? ?<I>options</I>?)</A><DD>
|
||||
The arguments consist of the names of one or more slave windows
|
||||
followed by pairs of arguments that specify how
|
||||
to manage the slaves.
|
||||
@@ -46,7 +67,7 @@ The following options are supported:
|
||||
<P>
|
||||
<P>
|
||||
<DL>
|
||||
<DT><A NAME="M8"><B>:column </B><I>n</I></A><DD>
|
||||
<DT><A NAME="M10"><B>:column </B><I>n</I></A><DD>
|
||||
Insert the slave so that it occupies the <I>n</I>th column in the grid.
|
||||
Column numbers start with 0. If this option is not supplied, then the
|
||||
slave is arranged just to the right of previous slave specified on this
|
||||
@@ -55,54 +76,58 @@ call to <I>grid</I>, or column "0" if it is the first slave. For each
|
||||
is incremented by one. Thus the <B>x</B> represents a blank column
|
||||
for this row in the grid.
|
||||
<P>
|
||||
<DT><A NAME="M9"><B>:columnspan </B><I>n</I></A><DD>
|
||||
<DT><A NAME="M11"><B>:columnspan </B><I>n</I></A><DD>
|
||||
Insert the slave so that it occupies <I>n</I> columns in the grid.
|
||||
The default is one column, unless the window name is followed by a
|
||||
<B>:</B>, in which case the columnspan is incremented once for each immediately
|
||||
following <B>:</B>.
|
||||
<P>
|
||||
<DT><A NAME="M10"><B>:in </B><I>other</I></A><DD>
|
||||
<DT><A NAME="M12"><B>:in </B><I>other</I></A><DD>
|
||||
Insert the slave(s) in the master
|
||||
window given by <I>other</I>. The default is the first slave's
|
||||
parent window.
|
||||
<P>
|
||||
<DT><A NAME="M11"><B>:ipadx </B><I>amount</I></A><DD>
|
||||
<DT><A NAME="M13"><B>:ipadx </B><I>amount</I></A><DD>
|
||||
The <I>amount</I> specifies how much horizontal internal padding to
|
||||
leave on each side of the slave(s).
|
||||
leave on each side of the slave(s). This is space is added
|
||||
inside the slave(s) border.
|
||||
The <I>amount</I> must be a valid screen distance, such as <B>2</B> or <B>.5c</B>.
|
||||
It defaults to 0.
|
||||
<P>
|
||||
<DT><A NAME="M12"><B>:ipady </B><I>amount</I></A><DD>
|
||||
<DT><A NAME="M14"><B>:ipady </B><I>amount</I></A><DD>
|
||||
The <I>amount</I> specifies how much vertical internal padding to
|
||||
leave on on the top and bottom of the slave(s).
|
||||
This space is added inside the slave(s) border.
|
||||
The <I>amount</I> defaults to 0.
|
||||
<P>
|
||||
<DT><A NAME="M13"><B>:padx </B><I>amount</I></A><DD>
|
||||
<DT><A NAME="M15"><B>:padx </B><I>amount</I></A><DD>
|
||||
The <I>amount</I> specifies how much horizontal external padding to
|
||||
leave on each side of the slave(s).
|
||||
leave on each side of the slave(s), in screen units.
|
||||
The <I>amount</I> defaults to 0.
|
||||
This space is added outside the slave(s) border.
|
||||
<P>
|
||||
<DT><A NAME="M14"><B>:pady </B><I>amount</I></A><DD>
|
||||
<DT><A NAME="M16"><B>:pady </B><I>amount</I></A><DD>
|
||||
The <I>amount</I> specifies how much vertical external padding to
|
||||
leave on the top and bottom of the slave(s).
|
||||
leave on the top and bottom of the slave(s), in screen units.
|
||||
The <I>amount</I> defaults to 0.
|
||||
This space is added outside the slave(s) border.
|
||||
<P>
|
||||
<DT><A NAME="M15"><B>:row </B><I>n</I></A><DD>
|
||||
<DT><A NAME="M17"><B>:row </B><I>n</I></A><DD>
|
||||
Insert the slave so that it occupies the <I>n</I>th row in the grid.
|
||||
Row numbers start with 0. If this option is not supplied, then the
|
||||
slave is arranged on the same row as the previous slave specified on this
|
||||
call to <B>grid</B>, or the first unoccupied row if this is the first slave.
|
||||
<P>
|
||||
<DT><A NAME="M16"><B>:rowspan </B><I>n</I></A><DD>
|
||||
<DT><A NAME="M18"><B>:rowspan </B><I>n</I></A><DD>
|
||||
Insert the slave so that it occupies <I>n</I> rows in the grid.
|
||||
The default is one row. If the next <B>grid</B> procedure contains
|
||||
<B>^</B> characters instead of <I>slaves</I> that line up with the columns
|
||||
of this <I>slave</I>, then the <B>rowspan</B> of this <I>slave</I> is
|
||||
extended by one.
|
||||
<P>
|
||||
<DT><A NAME="M17"><B>:sticky </B><I>style</I></A><DD>
|
||||
If a slave's parcel is larger than its requested dimensions, this
|
||||
option may be used to position (or stretch) the slave within its cavity.
|
||||
<DT><A NAME="M19"><B>:sticky </B><I>style</I></A><DD>
|
||||
If a slave's cell is larger than its requested dimensions, this
|
||||
option may be used to position (or stretch) the slave within its cell.
|
||||
<I>Style</I> is a string that contains zero or more of the characters
|
||||
<B>n</B>, <B>s</B>, <B>e</B> or <B>w</B>.
|
||||
The string can optionally contains spaces or
|
||||
@@ -121,25 +146,28 @@ If any of the slaves are already managed by the geometry manager
|
||||
then any unspecified options for them retain their previous values rather
|
||||
than receiving default values.
|
||||
</UL>
|
||||
<DT><A NAME="M18">(<B>grid 'forget </B><I>slave </I>?<I>slave ...</I>?)</A><DD>
|
||||
<DT><A NAME="M20">(<B>grid 'forget </B><I>slave </I>?<I>slave ...</I>?)</A><DD>
|
||||
Removes each of the <I>slave</I>s from grid for its
|
||||
master and unmaps their windows.
|
||||
The slaves will no longer be managed by the grid geometry manager.
|
||||
The configuration options for that window are forgotten, so that if the
|
||||
slave is managed once more by the grid geometry manager, the initial
|
||||
default settings are used.
|
||||
<P>
|
||||
<DT><A NAME="M19">(<B>grid 'info </B><I>slave</I>)</A><DD>
|
||||
<DT><A NAME="M21">(<B>grid 'info </B><I>slave</I>)</A><DD>
|
||||
Returns a list whose elements are the current configuration state of
|
||||
the slave given by <I>slave</I> in the same option-value form that
|
||||
might be specified to <B>grid configure</B>.
|
||||
The first two elements of the list are ``<B>:in </B><I>master</I>'' where
|
||||
<I>master</I> is the slave's master.
|
||||
<P>
|
||||
<DT><A NAME="M20">(<B>grid 'location </B><I>master x y</I>)</A><DD>
|
||||
<DT><A NAME="M22">(<B>grid 'location </B><I>master x y</I>)</A><DD>
|
||||
Given <I>x</I> and <I>y</I> values in screen units relative to the master window,
|
||||
the column and row number at that <I>x</I> and <I>y</I> location is returned.
|
||||
For locations that are above or to the left of the grid, <B>-1</B> is returned.
|
||||
<P>
|
||||
<DT><A NAME="M21">(<B>grid 'propagate </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M22">(<B>grid 'propagate </B><I>master</I> <I>boolean</I>)</A><DD>
|
||||
<DT><A NAME="M23">(<B>grid 'propagate </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M24">(<B>grid 'propagate </B><I>master</I> <I>boolean</I>)</A><DD>
|
||||
If <I>boolean</I> has a true boolean value
|
||||
then propagation is enabled for <I>master</I>, which must be a window
|
||||
name (see ``GEOMETRY PROPAGATION'' below).
|
||||
@@ -151,30 +179,55 @@ If <I>boolean</I> is omitted then the procedure returns <B>#f</B> or
|
||||
for <I>master</I>.
|
||||
Propagation is enabled by default.
|
||||
<P>
|
||||
<DT><A NAME="M23">(<B>grid 'rowconfigure</B> <I>master index </I>)</A><DD>
|
||||
<DT><A NAME="M24">(<B>grid 'rowconfigure</B> <I>master index </I><I>:option value...</I>)</A><DD>
|
||||
<DT><A NAME="M25">(<B>grid 'rowconfigure</B> <I>master index </I>)</A><DD>
|
||||
<DT><A NAME="M26">(<B>grid 'rowconfigure</B> <I>master index </I><I>:option value...</I>)</A><DD>
|
||||
Query or set the row properties of the <I>index</I> row of the
|
||||
geometry master, <I>master</I>.
|
||||
The valid options are <B>:minsize</B> and <B>:weight</B>.
|
||||
<B>Minsize</B> sets the minimum row size, in screen units, and <B>weight</B>
|
||||
sets the relative weight for apportioning any extra spaces among
|
||||
rows. If no value is specified, the current value is returned.
|
||||
The valid options are <B>:minsize</B>, <B>:weight</B> and <B>:pad</B>.
|
||||
If one or more options are provided, then <I>index</I> may be given as
|
||||
a list of row indeces to which the configuration options will operate on.
|
||||
The <B>:minsize</B> option sets the minimum size, in screen units,
|
||||
that will be permitted for this row.
|
||||
The <B>:weight</B> option (an integer value)
|
||||
sets the relative weight for apportioning
|
||||
any extra spaces among
|
||||
rows.
|
||||
A weight of zero (0) indicates the row will not deviate from its requested
|
||||
size. A row whose weight is two will grow at twice the rate as a row
|
||||
of weight one when extra space is allocated to the layout.
|
||||
The <B>:pad</B> option specifies the number of screen units that will be
|
||||
added to the largest window contained completely in that row when the
|
||||
grid geometry manager requests a size from the containing window.
|
||||
If only an option is specified, with no value,
|
||||
the current value of that option is returned.
|
||||
If only the master window and index is specified, all the current settings
|
||||
are returned in an list of ":option value" pairs.
|
||||
<P>
|
||||
<DT><A NAME="M25">(<B>grid 'size </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M27">(<B>grid 'remove </B><I>slave </I>?<I>slave ...</I>?)</A><DD>
|
||||
Removes each of the <I>slave</I>s from grid for its
|
||||
master and unmaps their windows.
|
||||
The slaves will no longer be managed by the grid geometry manager.
|
||||
However, the configuration options for that window are remembered,
|
||||
so that if the
|
||||
slave is managed once more by the grid geometry manager, the previous
|
||||
values are retained.
|
||||
<P>
|
||||
<DT><A NAME="M28">(<B>grid 'size </B><I>master</I>)</A><DD>
|
||||
Returns the size of the grid (in columns then rows) for <I>master</I>.
|
||||
The size is determined either by the <I>slave</I> occupying the largest
|
||||
row or column, or the largest column or row with a <B>minsize</B> or
|
||||
<B>weight</B>.
|
||||
row or column, or the largest column or row with a <B>minsize</B>,
|
||||
<B>weight</B>, or <B>pad</B> that is non-zero.
|
||||
<P>
|
||||
<DT><A NAME="M26">(<B>grid 'slaves </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M27">(<B>grid 'slaves </B><I>master</I> <I>:option value</I>)</A><DD>
|
||||
<DT><A NAME="M29">(<B>grid 'slaves </B><I>master</I>)</A><DD>
|
||||
<DT><A NAME="M30">(<B>grid 'slaves </B><I>master</I> <I>:option value</I>)</A><DD>
|
||||
If no options are supplied, a list of all of the slaves in <I>master</I>
|
||||
are returned. <I>Option</I> can be either <B>:row</B> or <B>:column</B> which
|
||||
are returned, most recently managed first.
|
||||
<I>Option</I> can be either <B>:row</B> or <B>:column</B> which
|
||||
causes only the slaves in the row (or column) specified by <I>value</I>
|
||||
to be returned.
|
||||
<P>
|
||||
</DL>
|
||||
<H3><A NAME="M28">RELATIVE PLACEMENT</A></H3>
|
||||
<H3><A NAME="M31">RELATIVE PLACEMENT</A></H3>
|
||||
The <B>grid</B> procedure contains a limited set of capabilities that
|
||||
permit layouts to be created without specifying the row and column
|
||||
information for each slave. This permits slaves to be rearranged,
|
||||
@@ -190,23 +243,55 @@ of the characters <B>:</B>, <B>^</B>, and <B>^</B> in <B>grid</B>
|
||||
procedure where <I>slave</I> names are normally expected.
|
||||
<P>
|
||||
<DL>
|
||||
<DT><A NAME="M29"><B>:</B></A><DD>
|
||||
<DT><A NAME="M32"><B>-</B></A><DD>
|
||||
This increases the columnspan of the <I>slave</I> to the left. Several
|
||||
<B>:</B>'s in a row will successively increase the columnspan. S <B>:</B>
|
||||
<B>-</B>'s in a row will successively increase the columnspan. A <B>-</B>
|
||||
may not follow a <B>^</B> or a <B>x</B>.
|
||||
<P>
|
||||
<DT><A NAME="M30"><B>x</B></A><DD>
|
||||
<DT><A NAME="M33"><B>x</B></A><DD>
|
||||
This leaves an empty column between the <I>slave</I> on the left and
|
||||
the <I>slave</I> on the right.
|
||||
<P>
|
||||
<DT><A NAME="M31"><B>^</B></A><DD>
|
||||
<DT><A NAME="M34"><B>^</B></A><DD>
|
||||
This extends the <B>rowspan</B> of the <I>slave</I> above the <B>^</B>'s
|
||||
in the grid. The number of <B>^</B>'s in a row must match the number of
|
||||
columns spanned by the <I>slave</I> above it.
|
||||
<P>
|
||||
</DL>
|
||||
<H3><A NAME="M32">GEOMETRY PROPAGATION</A></H3>
|
||||
Grid normally computes how large a master must be to
|
||||
<H3><A NAME="M35">THE GRID ALGORITHM</A></H3>
|
||||
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 <I>sticky</I> flag.
|
||||
<P>
|
||||
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
|
||||
<I>minsize</I> for that row or column, or the sum of the <I>pad</I>ding
|
||||
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 <I>weight</I>. For each
|
||||
group whose weights are all zero, the additional space is apportioned
|
||||
equally.
|
||||
<P>
|
||||
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.
|
||||
<H3><A NAME="M36">GEOMETRY PROPAGATION</A></H3>
|
||||
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
|
||||
@@ -219,14 +304,14 @@ 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.
|
||||
|
||||
<H3><A NAME="M33">RESTRICTIONS ON MASTER WINDOWS</A></H3>
|
||||
<H3><A NAME="M37">RESTRICTIONS ON MASTER WINDOWS</A></H3>
|
||||
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.
|
||||
|
||||
<H3><A NAME="M34">STACKING ORDER</A></H3>
|
||||
In addition, all slaves in one call to <B>grid</B> must have the same master.
|
||||
<H3><A NAME="M38">STACKING ORDER</A></H3>
|
||||
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
|
||||
@@ -234,15 +319,13 @@ 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.
|
||||
<H3><A NAME="M39">CREDITS</A></H3>
|
||||
The <B>grid</B> command is based on ideas taken from the <I>GridBag</I>
|
||||
geometry manager written by Doug. Stein, and the <B>blt_table</B> geometry
|
||||
manager, written by George Howlett.
|
||||
|
||||
<H3><A NAME="M35">CREDITS</A></H3>
|
||||
The <B>grid</B> procedure is based on the <I>GridBag</I> geometry manager
|
||||
written by D. Stein. The first table-based geometry manager for Tk
|
||||
was <B>blt_table</B>, written by George Howlett; many of the features
|
||||
of <B>grid</B> are similar to features in <B>blt_table</B>.
|
||||
|
||||
<H3><A NAME="M36">SEE ALSO</A></H3>
|
||||
<H3><A NAME="M40">SEE ALSO</A></H3>
|
||||
<B><A HREF="./pack.n.html">pack</A></B>, <B><A HREF="./place.n.html">place</A></B>
|
||||
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
|
||||
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif"><P>
|
||||
<A HREF=./STk-hlp.html><IMG ALIGN=BOTTOM SRC="./Img/RefBookBlue.gif"> Back to the <B>STk</B> main page</A>
|
||||
</BODY></HTML>
|
||||
|
||||
Reference in New Issue
Block a user