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