| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>place (GCL TK Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="place (GCL TK Manual)"> |
| 9 |
<meta name="keywords" content="place (GCL TK Manual)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 15 |
<link href="Control.html" rel="up" title="Control"> |
| 16 |
<link href="raise.html" rel="next" title="raise"> |
| 17 |
<link href="pack.html" rel="prev" title="pack"> |
| 18 |
<style type="text/css"> |
| 19 |
<!-- |
| 20 |
a.summary-letter {text-decoration: none} |
| 21 |
blockquote.indentedblock {margin-right: 0em} |
| 22 |
div.display {margin-left: 3.2em} |
| 23 |
div.example {margin-left: 3.2em} |
| 24 |
div.lisp {margin-left: 3.2em} |
| 25 |
kbd {font-style: oblique} |
| 26 |
pre.display {font-family: inherit} |
| 27 |
pre.format {font-family: inherit} |
| 28 |
pre.menu-comment {font-family: serif} |
| 29 |
pre.menu-preformatted {font-family: serif} |
| 30 |
span.nolinebreak {white-space: nowrap} |
| 31 |
span.roman {font-family: initial; font-weight: normal} |
| 32 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 33 |
ul.no-bullet {list-style: none} |
| 34 |
--> |
| 35 |
</style> |
| 36 |
|
| 37 |
|
| 38 |
</head> |
| 39 |
|
| 40 |
<body lang="en"> |
| 41 |
<span id="place"></span><div class="header"> |
| 42 |
<p> |
| 43 |
Next: <a href="raise.html" accesskey="n" rel="next">raise</a>, Previous: <a href="pack.html" accesskey="p" rel="prev">pack</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 44 |
</div> |
| 45 |
<hr> |
| 46 |
<span id="place-1"></span><h3 class="section">3.15 place</h3> |
| 47 |
|
| 48 |
<p>place \- Geometry manager for fixed or rubber-sheet placement |
| 49 |
</p><span id="Synopsis-28"></span><h4 class="unnumberedsubsec">Synopsis</h4> |
| 50 |
<p><b>place </b><i>window option value </i><span class="roman">?</span><i>option value ...</i>? |
| 51 |
</p><br> |
| 52 |
<p><b>place configure </b><i>window option value </i><span class="roman">?</span><i>option value ...</i>? |
| 53 |
</p><br> |
| 54 |
<p><b>place forget </b><i>window</i> |
| 55 |
</p><br> |
| 56 |
<p><b>place info </b><i>window</i> |
| 57 |
</p><br> |
| 58 |
<p><b>place slaves </b><i>window</i> |
| 59 |
</p> |
| 60 |
<span id="Description-26"></span><h4 class="unnumberedsubsec">Description</h4> |
| 61 |
|
| 62 |
<p>The placer is a geometry manager for Tk. |
| 63 |
It provides simple fixed placement of windows, where you specify |
| 64 |
the exact size and location of one window, called the <i>slave</i>, |
| 65 |
within another window, called the <i>master</i>. |
| 66 |
The placer also provides rubber-sheet placement, where you specify the |
| 67 |
size and location of the slave in terms of the dimensions of |
| 68 |
the master, so that the slave changes size and location |
| 69 |
in response to changes in the size of the master. |
| 70 |
Lastly, the placer allows you to mix these styles of placement so |
| 71 |
that, for example, the slave has a fixed width and height but is |
| 72 |
centered inside the master. |
| 73 |
</p> |
| 74 |
<p>If the first argument to the <b>place</b> command is a window path |
| 75 |
name or <b>configure</b> then the command arranges for the placer |
| 76 |
to manage the geometry of a slave whose path name is <i>window</i>. |
| 77 |
The remaining arguments consist of one or more <i>option:value</i> |
| 78 |
pairs that specify the way in which <i>window</i>’s |
| 79 |
geometry is managed. |
| 80 |
If the placer is already managing <i>window</i>, then the |
| 81 |
<i>option:value</i><span class="roman"> pairs modify the configuration for </span><i>window</i>. |
| 82 |
In this form the <b>place</b> command returns an empty string as result. |
| 83 |
The following <i>option:value</i> pairs are supported: |
| 84 |
</p> |
| 85 |
<dl compact="compact"> |
| 86 |
<dt><b>:in </b><i>master</i></dt> |
| 87 |
<dd><p><i>Master</i> specifes the path name of the window relative |
| 88 |
to which <i>window</i> is to be placed. |
| 89 |
<i>Master</i><span class="roman"> must either be </span><i>window</i>’s parent or a descendant |
| 90 |
of <i>window</i>’s parent. |
| 91 |
In addition, <i>master</i><span class="roman"> and </span><i>window</i> must both be descendants |
| 92 |
of the same top-level window. |
| 93 |
These restrictions are necessary to guarantee |
| 94 |
that <i>window</i><span class="roman"> is visible whenever </span><i>master</i> is visible. |
| 95 |
If this option isn’t specified then the master defaults to |
| 96 |
<i>window</i>’s parent. |
| 97 |
</p></dd> |
| 98 |
<dt><b>:x </b><i>location</i></dt> |
| 99 |
<dd><p><i>Location</i> specifies the x-coordinate within the master window |
| 100 |
of the anchor point for <i>window</i>. |
| 101 |
The location is specified in screen units (i.e. any of the forms |
| 102 |
accepted by <b>Tk_GetPixels</b>) and need not lie within the bounds |
| 103 |
of the master window. |
| 104 |
</p></dd> |
| 105 |
<dt><b>:relx </b><i>location</i></dt> |
| 106 |
<dd><p><i>Location</i> specifies the x-coordinate within the master window |
| 107 |
of the anchor point for <i>window</i>. |
| 108 |
In this case the location is specified in a relative fashion |
| 109 |
as a floating-point number: 0.0 corresponds to the left edge |
| 110 |
of the master and 1.0 corresponds to the right edge of the master. |
| 111 |
<i>Location</i> need not be in the range 0.0\-1.0. |
| 112 |
</p></dd> |
| 113 |
<dt><b>:y </b><i>location</i></dt> |
| 114 |
<dd><p><i>Location</i> specifies the y-coordinate within the master window |
| 115 |
of the anchor point for <i>window</i>. |
| 116 |
The location is specified in screen units (i.e. any of the forms |
| 117 |
accepted by <b>Tk_GetPixels</b>) and need not lie within the bounds |
| 118 |
of the master window. |
| 119 |
</p></dd> |
| 120 |
<dt><b>:rely </b><i>location</i></dt> |
| 121 |
<dd><p><i>Location</i> specifies the y-coordinate within the master window |
| 122 |
of the anchor point for <i>window</i>. |
| 123 |
In this case the value is specified in a relative fashion |
| 124 |
as a floating-point number: 0.0 corresponds to the top edge |
| 125 |
of the master and 1.0 corresponds to the bottom edge of the master. |
| 126 |
<i>Location</i> need not be in the range 0.0\-1.0. |
| 127 |
</p></dd> |
| 128 |
<dt><b>:anchor </b><i>where</i></dt> |
| 129 |
<dd><p><i>Where</i><span class="roman"> specifies which point of </span><i>window</i> is to be positioned |
| 130 |
at the (x,y) location selected by the <b>:x</b><span class="roman">, </span><b>:y</b>, |
| 131 |
<b>:relx</b><span class="roman">, and </span><b>:rely</b> options. |
| 132 |
The anchor point is in terms of the outer area of <i>window</i> |
| 133 |
including its border, if any. |
| 134 |
Thus if <i>where</i><span class="roman"> is </span><b>se</b> then the lower-right corner of |
| 135 |
<i>window</i>’s border will appear at the given (x,y) location |
| 136 |
in the master. |
| 137 |
The anchor position defaults to <b>nw</b>. |
| 138 |
</p></dd> |
| 139 |
<dt><b>:width </b><i>size</i></dt> |
| 140 |
<dd><p><i>Size</i><span class="roman"> specifies the width for </span><i>window</i> in screen units |
| 141 |
(i.e. any of the forms accepted by <b>Tk_GetPixels</b>). |
| 142 |
The width will be the outer width of <i>window</i> including its |
| 143 |
border, if any. |
| 144 |
If <i>size</i><span class="roman"> is an empty string, or if no </span><b>:width</b> |
| 145 |
or <b>:relwidth</b> option is specified, then the width requested |
| 146 |
internally by the window will be used. |
| 147 |
</p></dd> |
| 148 |
<dt><b>:relwidth </b><i>size</i></dt> |
| 149 |
<dd><p><i>Size</i><span class="roman"> specifies the width for </span><i>window</i>. |
| 150 |
In this case the width is specified as a floating-point number |
| 151 |
relative to the width of the master: 0.5 means <i>window</i> will |
| 152 |
be half as wide as the master, 1.0 means <i>window</i> will have |
| 153 |
the same width as the master, and so on. |
| 154 |
</p></dd> |
| 155 |
<dt><b>:height </b><i>size</i></dt> |
| 156 |
<dd><p><i>Size</i><span class="roman"> specifies the height for </span><i>window</i> in screen units |
| 157 |
(i.e. any of the forms accepted by <b>Tk_GetPixels</b>). |
| 158 |
The height will be the outer dimension of <i>window</i> including its |
| 159 |
border, if any. |
| 160 |
If <i>size</i><span class="roman"> is an empty string, or if no </span><b>:height</b> or |
| 161 |
<b>:relheight</b> option is specified, then the height requested |
| 162 |
internally by the window will be used. |
| 163 |
</p></dd> |
| 164 |
<dt><b>:relheight </b><i>size</i></dt> |
| 165 |
<dd><p><i>Size</i><span class="roman"> specifies the height for </span><i>window</i>. |
| 166 |
In this case the height is specified as a floating-point number |
| 167 |
relative to the height of the master: 0.5 means <i>window</i> will |
| 168 |
be half as high as the master, 1.0 means <i>window</i> will have |
| 169 |
the same height as the master, and so on. |
| 170 |
</p></dd> |
| 171 |
<dt><b>:bordermode </b><i>mode</i></dt> |
| 172 |
<dd><p><i>Mode</i> determines the degree to which borders within the |
| 173 |
master are used in determining the placement of the slave. |
| 174 |
The default and most common value is <b>inside</b>. |
| 175 |
In this case the placer considers the area of the master to |
| 176 |
be the innermost area of the master, inside any border: |
| 177 |
an option of <b>:x 0</b> corresponds to an x-coordinate just |
| 178 |
inside the border and an option of <b>:relwidth 1.0</b> |
| 179 |
means <i>window</i> will fill the area inside the master’s |
| 180 |
border. |
| 181 |
If <i>mode</i><span class="roman"> is </span><b>outside</b> then the placer considers |
| 182 |
the area of the master to include its border; |
| 183 |
this mode is typically used when placing <i>window</i> |
| 184 |
outside its master, as with the options <b>:x 0 :y 0 :anchor ne</b>. |
| 185 |
Lastly, <i>mode</i><span class="roman"> may be specified as </span><b>ignore</b>, in which |
| 186 |
case borders are ignored: the area of the master is considered |
| 187 |
to be its official X area, which includes any internal border but |
| 188 |
no external border. A bordermode of <b>ignore</b> is probably |
| 189 |
not very useful. |
| 190 |
</p> |
| 191 |
<p>If the same value is specified separately with |
| 192 |
two different options, such as <b>:x</b><span class="roman"> and </span><b>:relx</b>, then |
| 193 |
the most recent option is used and the older one is ignored. |
| 194 |
</p> |
| 195 |
<p>The <b>place slaves</b> command returns a list of all the slave |
| 196 |
windows for which <i>window</i> is the master. |
| 197 |
If there are no slaves for <i>window</i> then an empty string is |
| 198 |
returned. |
| 199 |
</p> |
| 200 |
<p>The <b>place forget</b> command causes the placer to stop managing |
| 201 |
the geometry of <i>window</i>. As a side effect of this command |
| 202 |
<i>window</i> will be unmapped so that it doesn’t appear on the |
| 203 |
screen. |
| 204 |
If <i>window</i> isn’t currently managed by the placer then the |
| 205 |
command has no effect. |
| 206 |
<b>Place forget</b> returns an empty string as result. |
| 207 |
</p> |
| 208 |
<p>The <b>place info</b> command returns a list giving the current |
| 209 |
configuration of <i>window</i>. |
| 210 |
The list consists of <i>option:value</i> pairs in exactly the |
| 211 |
same form as might be specified to the <b>place configure</b> |
| 212 |
command. |
| 213 |
If the configuration of a window has been retrieved with |
| 214 |
<b>place info</b>, that configuration can be restored later by |
| 215 |
first using <b>place forget</b> to erase any existing information |
| 216 |
for the window and then invoking <b>place configure</b> with |
| 217 |
the saved information. |
| 218 |
</p> |
| 219 |
</dd> |
| 220 |
</dl> |
| 221 |
<span id="g_t_0022Fine-Points_0022"></span><h4 class="unnumberedsubsec">"Fine Points"</h4> |
| 222 |
|
| 223 |
<p>It is not necessary for the master window to be the parent |
| 224 |
of the slave window. |
| 225 |
This feature is useful in at least two situations. |
| 226 |
First, for complex window layouts it means you can create a |
| 227 |
hierarchy of subwindows whose only purpose |
| 228 |
is to assist in the layout of the parent. |
| 229 |
The “real children” of the parent (i.e. the windows that |
| 230 |
are significant for the application’s user interface) can be |
| 231 |
children of the parent yet be placed inside the windows |
| 232 |
of the geometry-management hierarchy. |
| 233 |
This means that the path names of the “real children” |
| 234 |
don’t reflect the geometry-management hierarchy and users |
| 235 |
can specify options for the real children |
| 236 |
without being aware of the structure of the geometry-management |
| 237 |
hierarchy. |
| 238 |
</p> |
| 239 |
<p>A second reason for having a master different than the slave’s |
| 240 |
parent is to tie two siblings together. |
| 241 |
For example, the placer can be used to force a window always to |
| 242 |
be positioned centered just below one of its |
| 243 |
siblings by specifying the configuration |
| 244 |
</p> |
| 245 |
<div class="example"> |
| 246 |
<pre class="example"><b>:in </b><i>sibling</i><b> :relx 0.5 :rely 1.0 :anchor n :bordermode outside</b> |
| 247 |
</pre></div> |
| 248 |
|
| 249 |
<p>Whenever the sibling is repositioned in the future, the slave |
| 250 |
will be repositioned as well. |
| 251 |
</p> |
| 252 |
<p>Unlike many other geometry managers (such as the packer) |
| 253 |
the placer does not make any attempt to manipulate the geometry of |
| 254 |
the master windows or the parents of slave windows (i.e. it doesn’t |
| 255 |
set their requested sizes). |
| 256 |
To control the sizes of these windows, make them windows like |
| 257 |
frames and canvases that provide configuration options for this purpose. |
| 258 |
</p> |
| 259 |
<span id="Keywords-29"></span><h4 class="unnumberedsubsec">Keywords</h4> |
| 260 |
<p>geometry manager, height, location, master, place, rubber sheet, slave, width |
| 261 |
</p><hr> |
| 262 |
<div class="header"> |
| 263 |
<p> |
| 264 |
Next: <a href="raise.html" accesskey="n" rel="next">raise</a>, Previous: <a href="pack.html" accesskey="p" rel="prev">pack</a>, Up: <a href="Control.html" accesskey="u" rel="up">Control</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 265 |
</div> |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
</body> |
| 270 |
</html> |