diff options
Diffstat (limited to 'doc/grid.n')
-rw-r--r-- | doc/grid.n | 74 |
1 files changed, 49 insertions, 25 deletions
@@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: grid.n,v 1.20.2.1 2009/07/11 07:30:24 dkf Exp $ +'\" RCS: @(#) $Id: grid.n,v 1.23 2009/07/11 07:25:32 dkf Exp $ '\" .so man.macros .TH grid n 8.5 Tk "Tk Built-In Commands" @@ -24,44 +24,44 @@ The \fBgrid\fR command can have any of several forms, depending on the \fIoption\fR argument: .TP \fBgrid \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR? +. If the first argument to \fBgrid\fR is suitable as the first slave argument to \fBgrid configure\fR, either a window name (any value -starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR +starting with \fB.\fR) or one of the characters \fBx\fR or \fB^\fR (see the \fBRELATIVE PLACEMENT\fR section below), then the command is processed in the same way as \fBgrid configure\fR. -.VS 8.5 .TP \fBgrid anchor \fImaster\fR ?\fIanchor\fR? +. The anchor value controls how to place the grid within the master when no row/column has any weight. See \fBTHE GRID ALGORITHM\fR below for further details. The default \fIanchor\fR is \fInw\fR. -.VE 8.5 .TP \fBgrid bbox \fImaster\fR ?\fIcolumn row\fR? ?\fIcolumn2 row2\fR? -With no arguments, +. +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 \fIcolumn\fR and \fIrow\fR is specified on +also in pixels. If a single \fIcolumn\fR and \fIrow\fR 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 \fIcolumn\fR and \fIrow\fR arguments are specified, then the bounding box spanning the rows and columns indicated is returned. .TP \fBgrid columnconfigure \fImaster index \fR?\fI\-option value...\fR? -Query or set the column properties of the \fIindex\fR column of the +. +Query or set the column properties of the \fIindex\fR column of the geometry master, \fImaster\fR. The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR and \fB\-pad\fR. -If one or more options are provided, then \fIindex\fR may be given as +If one or more options are provided, then \fIindex\fR may be given as a list of column indices to which the configuration options will operate on. -.VS 8.5 Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR the options apply to all columns currently occupied be slave windows. For a window name, that window must be a slave of this master and the options apply to all columns currently occupied be the slave. -.VE 8.5 The \fB\-minsize\fR option sets the minimum size, in screen units, that will be permitted for this column. The \fB\-weight\fR option (an integer value) @@ -88,10 +88,11 @@ are returned in a list of pairs. .TP \fBgrid configure \fIslave \fR?\fIslave ...\fR? ?\fIoptions\fR? +. The arguments consist of the names of one or more slave windows followed by pairs of arguments that specify how to manage the slaves. -The characters \fB\-\fR, \fBx\fR and \fB^\fR, +The characters \fB\-\fR, \fBx\fR and \fB^\fR, can be specified instead of a window name to alter the default location of a \fIslave\fR, as described in the \fBRELATIVE PLACEMENT\fR section, below. @@ -99,6 +100,7 @@ The following options are supported: .RS .TP \fB\-column \fIn\fR +. Insert the slave so that it occupies the \fIn\fRth 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 @@ -110,17 +112,20 @@ is incremented by one. Thus the \fBx\fR represents a blank column for this row in the grid. .TP \fB\-columnspan \fIn\fR +. Insert the slave so that it occupies \fIn\fR columns in the grid. The default is one column, unless the window name is followed by a \fB\-\fR, in which case the columnspan is incremented once for each immediately following \fB\-\fR. .TP \fB\-in \fIother\fR +. Insert the slave(s) in the master window given by \fIother\fR. The default is the first slave's parent window. .TP \fB\-ipadx \fIamount\fR +. The \fIamount\fR specifies how much horizontal internal padding to leave on each side of the slave(s). This is space is added inside the slave(s) border. @@ -128,12 +133,14 @@ The \fIamount\fR must be a valid screen distance, such as \fB2\fR or \fB.5c\fR. It defaults to 0. .TP \fB\-ipady \fIamount\fR +. The \fIamount\fR specifies how much vertical internal padding to leave on the top and bottom of the slave(s). This space is added inside the slave(s) border. The \fIamount\fR defaults to 0. .TP \fB\-padx \fIamount\fR +. The \fIamount\fR specifies how much horizontal external padding to leave on each side of the slave(s), in screen units. \fIAmount\fR may be a list @@ -142,6 +149,7 @@ The \fIamount\fR defaults to 0. This space is added outside the slave(s) border. .TP \fB\-pady \fIamount\fR +. The \fIamount\fR specifies how much vertical external padding to leave on the top and bottom of the slave(s), in screen units. \fIAmount\fR may be a list @@ -150,12 +158,14 @@ The \fIamount\fR defaults to 0. This space is added outside the slave(s) border. .TP \fB\-row \fIn\fR +. Insert the slave so that it occupies the \fIn\fRth 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 \fBgrid\fR, or the first unoccupied row if this is the first slave. .TP \fB\-rowspan \fIn\fR +. Insert the slave so that it occupies \fIn\fR rows in the grid. The default is one row. If the next \fBgrid\fR command contains \fB^\fR characters instead of \fIslaves\fR that line up with the columns @@ -163,6 +173,7 @@ of this \fIslave\fR, then the \fBrowspan\fR of this \fIslave\fR is extended by one. .TP \fB\-sticky \fIstyle\fR +. 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. \fIStyle\fR is a string that contains zero or more of the characters @@ -185,6 +196,7 @@ than receiving default values. .RE .TP \fBgrid forget \fIslave \fR?\fIslave ...\fR? +. Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. @@ -193,6 +205,7 @@ slave is managed once more by the grid geometry manager, the initial default settings are used. .TP \fBgrid info \fIslave\fR +. Returns a list whose elements are the current configuration state of the slave given by \fIslave\fR in the same option-value form that might be specified to \fBgrid configure\fR. @@ -201,12 +214,14 @@ The first two elements of the list are where \fImaster\fR is the slave's master. .TP \fBgrid location \fImaster x y\fR -Given \fIx\fR and \fIy\fR values in screen units relative to the master window, +. +Given \fIx\fR and \fIy\fR values in screen units relative to the master window, the column and row number at that \fIx\fR and \fIy\fR location is returned. For locations that are above or to the left of the grid, \fB\-1\fR is returned. .TP \fBgrid propagate \fImaster\fR ?\fIboolean\fR? +. If \fIboolean\fR has a true boolean value such as \fB1\fR or \fBon\fR then propagation is enabled for \fImaster\fR, which must be a window name (see \fBGEOMETRY PROPAGATION\fR below). @@ -219,18 +234,17 @@ for \fImaster\fR. Propagation is enabled by default. .TP \fBgrid rowconfigure \fImaster index \fR?\fI\-option value...\fR? -Query or set the row properties of the \fIindex\fR row of the +. +Query or set the row properties of the \fIindex\fR row of the geometry master, \fImaster\fR. The valid options are \fB\-minsize\fR, \fB\-weight\fR, \fB\-uniform\fR and \fB\-pad\fR. -If one or more options are provided, then \fIindex\fR may be given as +If one or more options are provided, then \fIindex\fR may be given as a list of row indices to which the configuration options will operate on. -.VS 8.5 Indices may be integers, window names or the keyword \fIall\fR. For \fIall\fR the options apply to all rows currently occupied be slave windows. For a window name, that window must be a slave of this master and the options apply to all rows currently occupied be the slave. -.VE 8.5 The \fB\-minsize\fR option sets the minimum size, in screen units, that will be permitted for this row. The \fB\-weight\fR option (an integer value) @@ -257,6 +271,7 @@ are returned in a list of pairs. .TP \fBgrid remove \fIslave \fR?\fIslave ...\fR? +. Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. @@ -266,12 +281,14 @@ slave is managed once more by the grid geometry manager, the previous values are retained. .TP \fBgrid size \fImaster\fR +. Returns the size of the grid (in columns then rows) for \fImaster\fR. The size is determined either by the \fIslave\fR occupying the largest -row or column, or the largest column or row with a \fBminsize\fR, +row or column, or the largest column or row with a \fBminsize\fR, \fBweight\fR, or \fBpad\fR that is non-zero. .TP \fBgrid slaves \fImaster\fR ?\fI\-option value\fR? +. If no options are supplied, a list of all of the slaves in \fImaster\fR are returned, most recently manages first. \fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which @@ -280,11 +297,11 @@ to be returned. .SH "RELATIVE PLACEMENT" .PP The \fBgrid\fR command 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, +permit layouts to be created without specifying the row and column +information for each slave. This permits slaves to be rearranged, added, or removed without the need to explicitly specify row and column information. -When no column or row information is specified for a \fIslave\fR, +When no column or row information is specified for a \fIslave\fR, default values are chosen for \fBcolumn\fR, \fBrow\fR, \fBcolumnspan\fR and \fBrowspan\fR at the time the \fIslave\fR is managed. The values are chosen @@ -295,16 +312,19 @@ command where \fIslave\fR names are normally expected. .RS .TP \fB\-\fR +. This increases the columnspan of the \fIslave\fR to the left. Several \fB\-\fR's in a row will successively increase the columnspan. A \fB\-\fR may not follow a \fB^\fR or a \fBx\fR, nor may it be the first \fIslave\fR argument to \fBgrid configure\fR. .TP \fBx\fR +. This leaves an empty column between the \fIslave\fR on the left and the \fIslave\fR on the right. .TP \fB^\fR +. This extends the \fBrowspan\fR of the \fIslave\fR above the \fB^\fR's in the grid. The number of \fB^\fR's in a row must match the number of columns spanned by the \fIslave\fR above it. @@ -339,9 +359,9 @@ allocated to them is always in proportion to their weights. (A weight of zero is considered to be 1.) In other words, a row or column configured with \fB\-weight 1 \-uniform a\fR will have exactly the same size as any other row or column configured with \fB\-weight 1 \-uniform -a\fR. A row or column configured with \fB\-weight 2 \-uniform b\fR will +a\fR. A row or column configured with \fB\-weight 2 \-uniform b\fR will be exactly twice as large as one that is configured with \fB\-weight 1 -\-uniform b\fR. +\-uniform b\fR. .PP More technically, each row or column in the group will have a size equal to \fIk*weight\fR for some constant \fIk\fR. The constant @@ -350,18 +370,16 @@ minimum size. For example, if all rows or columns in a group have the same weight, then each row or column will have the same size as the largest row or column in the group. .PP -.VS 8.5 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 placed within its master according to the \fIanchor\fR value. 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 +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 their minimum sizes, the layout is placed and clipped according to the \fIanchor\fR value. -.VE 8.5 .SH "GEOMETRY PROPAGATION" .PP The grid geometry manager normally computes how large a master must be to @@ -399,7 +417,9 @@ The \fBgrid\fR command is based on ideas taken from the \fIGridBag\fR geometry manager written by Doug. Stein, and the \fBblt_table\fR geometry manager, written by George Howlett. .SH EXAMPLES +.PP A toplevel window containing a text widget and two scrollbars: +.PP .CS # Make the widgets toplevel .t @@ -419,6 +439,7 @@ scrollbar .t.h \-orient horizontal \-command {.t.txt xview} Three widgets of equal width, despite their different .QW natural widths: +.PP .CS button .b \-text "Foo" entry .e \-variable foo @@ -431,3 +452,6 @@ label .l \-text "This is a fairly long piece of text" pack(n), place(n) .SH KEYWORDS geometry manager, location, grid, cell, propagation, size, pack +'\" Local Variables: +'\" mode: nroff +'\" End: |