1place(3)              User Contributed Perl Documentation             place(3)
2
3
4

NAME

6       Tk::place - Geometry manager for fixed or rubber-sheet placement
7

SYNOPSIS

9        $widget->place?(-option=>value?, -option=>value, ...)?
10
11        $widget->placeForget
12
13        $widget->placeInfo
14
15        $master->placeSlaves
16

DESCRIPTION

18       The placer is a geometry manager for Tk.  It provides simple fixed
19       placement of windows, where you specify the exact size and location of
20       one window, called the slave, within another window, called the $mas‐
21       ter.  The placer also provides rubber-sheet placement, where you spec‐
22       ify the size and location of the slave in terms of the dimensions of
23       the master, so that the slave changes size and location in response to
24       changes in the size of the master.  Lastly, the placer allows you to
25       mix these styles of placement so that, for example, the slave has a
26       fixed width and height but is centered inside the master.
27
28       $slave->place?(-option=>value?, -option=>value, ...?)?
29           The place method arranges for the placer to manage the geometry of
30           $slave.  The remaining arguments consist of one or more
31           -option=>value pairs that specify the way in which $slave's geome‐
32           try is managed.  If the placer is already managing $slave, then the
33           -option=>value pairs modify the configuration for $slave.  The
34           place method returns an empty string as result.  The following
35           -option=>value pairs are supported:
36
37           -in => $master
38                   $master is the reference to the window relative to which
39                   $slave is to be placed.  $master must either be $slave's
40                   parent or a descendant of $slave's parent.  In addition,
41                   $master and $slave must both be descendants of the same
42                   top-level window.  These restrictions are necessary to
43                   guarantee that $slave is visible whenever $master is visi‐
44                   ble.  If this option isn't specified then the master
45                   defaults to $slave's parent.
46
47           -x => location
48                   Location specifies the x-coordinate within the master win‐
49                   dow of the anchor point for $slave widget.  The location is
50                   specified in screen units (i.e. any of the forms accepted
51                   by Tk_GetPixels) and need not lie within the bounds of the
52                   master window.
53
54           -relx => location
55                   Location specifies the x-coordinate within the master win‐
56                   dow of the anchor point for $slave widget.  In this case
57                   the location is specified in a relative fashion as a float‐
58                   ing-point number:  0.0 corresponds to the left edge of the
59                   master and 1.0 corresponds to the right edge of the master.
60                   Location need not be in the range 0.0-1.0.  If both -x and
61                   -relx are specified for a slave then their values are
62                   summed.  For example, "-relx=>0.5, -x=-2" positions the
63                   left edge of the slave 2 pixels to the left of the center
64                   of its master.
65
66           -y => location
67                   Location specifies the y-coordinate within the master win‐
68                   dow of the anchor point for $slave widget.  The location is
69                   specified in screen units (i.e. any of the forms accepted
70                   by Tk_GetPixels) and need not lie within the bounds of the
71                   master window.
72
73           -rely => location
74                   Location specifies the y-coordinate within the master win‐
75                   dow of the anchor point for $slave widget.  In this case
76                   the value is specified in a relative fashion as a floating-
77                   point number:  0.0 corresponds to the top edge of the mas‐
78                   ter and 1.0 corresponds to the bottom edge of the master.
79                   Location need not be in the range 0.0-1.0.  If both -y and
80                   -rely are specified for a slave then their values are
81                   summed.  For example, -rely=>0.5, -x=>3 positions the top
82                   edge of the slave 3 pixels below the center of its master.
83
84           -anchor => where
85                   Where specifies which point of $slave is to be positioned
86                   at the (x,y) location selected by the -x, -y, -relx, and
87                   -rely options.  The anchor point is in terms of the outer
88                   area of $slave including its border, if any.  Thus if where
89                   is se then the lower-right corner of $slave's border will
90                   appear at the given (x,y) location in the master.  The
91                   anchor position defaults to nw.
92
93           -width => size
94                   Size specifies the width for $slave in screen units (i.e.
95                   any of the forms accepted by Tk_GetPixels).  The width will
96                   be the outer width of $slave including its border, if any.
97                   If size is an empty string, or if no -width or -relwidth
98                   option is specified, then the width requested internally by
99                   the window will be used.
100
101           -relwidth => size
102                   Size specifies the width for $slave.  In this case the
103                   width is specified as a floating-point number relative to
104                   the width of the master: 0.5 means $slave will be half as
105                   wide as the master, 1.0 means $slave will have the same
106                   width as the master, and so on.  If both -width and -rel‐
107                   width are specified for a slave, their values are summed.
108                   For example, -relwidth=>1.0, -width=>5 makes the slave 5
109                   pixels wider than the master.
110
111           -height => size
112                   Size specifies the height for $slave in screen units (i.e.
113                   any of the forms accepted by Tk_GetPixels).  The height
114                   will be the outer dimension of $slave including its border,
115                   if any.  If size is an empty string, or if no -height or
116                   -relheight option is specified, then the height requested
117                   internally by the window will be used.
118
119           -relheight => size
120                   Size specifies the height for $slave.  In this case the
121                   height is specified as a floating-point number relative to
122                   the height of the master: 0.5 means $slave will be half as
123                   high as the master, 1.0 means $slave will have the same
124                   height as the master, and so on.  If both -height and -rel‐
125                   height are specified for a slave, their values are summed.
126                   For example, -relheight=>1.0, -height=>-2 makes the slave 2
127                   pixels shorter than the master.
128
129           -bordermode => mode
130                   Mode determines the degree to which borders within the mas‐
131                   ter are used in determining the placement of the slave.
132                   The default and most common value is inside.  In this case
133                   the placer considers the area of the master to be the
134                   innermost area of the master, inside any border: an option
135                   of -x=>0 corresponds to an x-coordinate just inside the
136                   border and an option of -relwidth=>1.0 means $slave will
137                   fill the area inside the master's border.  If mode is out‐
138                   side then the placer considers the area of the master to
139                   include its border; this mode is typically used when plac‐
140                   ing $slave outside its master, as with the options -x=>0,
141                   -y=>0, -anchor=>ne.  Lastly, mode may be specified as
142                   ignore, in which case borders are ignored:  the area of the
143                   master is considered to be its official X area, which
144                   includes any internal border but no external border.  A
145                   bordermode of ignore is probably not very useful.
146
147                   If the same value is specified separately with two differ‐
148                   ent options, such as -x and -relx, then the most recent
149                   option is used and the older one is ignored.
150
151       $slave->placeSlaves
152           The placeSlaves method returns a list of all the slave windows for
153           which $master is the master.  If there are no slaves for $master
154           then an empty list is returned.
155
156       $slave->placeForget
157           The placeForget method causes the placer to stop managing the geom‐
158           etry of $slave.  As a side effect of this method call $slave will
159           be unmapped so that it doesn't appear on the screen.  If $slave
160           isn't currently managed by the placer then the method call has no
161           effect.  placeForget returns an empty string as result.
162
163       $slave->placeInfo
164           The placeInfo method returns a list giving the current configura‐
165           tion of $slave.  The list consists of -option=>value pairs in
166           exactly the same form as might be specified to the place method.
167           If the configuration of a window has been retrieved with placeInfo,
168           that configuration can be restored later by first using placeForget
169           to erase any existing information for the window and then invoking
170           place with the saved information.
171

FINE POINTS

173       It is not necessary for the master window to be the parent of the slave
174       window.  This feature is useful in at least two situations.  First, for
175       complex window layouts it means you can create a hierarchy of subwin‐
176       dows whose only purpose is to assist in the layout of the parent.  The
177       ``real children'' of the parent (i.e. the windows that are significant
178       for the application's user interface) can be children of the parent yet
179       be placed inside the windows of the geometry-management hierarchy.
180       This means that the path names of the ``real children'' don't reflect
181       the geometry-management hierarchy and users can specify options for the
182       real children without being aware of the structure of the geometry-man‐
183       agement hierarchy.
184
185       A second reason for having a master different than the slave's parent
186       is to tie two siblings together.  For example, the placer can be used
187       to force a window always to be positioned centered just below one of
188       its siblings by specifying the configuration
189
190        -in=>$sibling, -relx=>0.5, -rely=>1.0, -anchor=>'n', -border‐
191       mode=>'outside'
192
193       Whenever the $sibling widget is repositioned in the future, the slave
194       will be repositioned as well.
195
196       Unlike many other geometry managers (such as the packer) the placer
197       does not make any attempt to manipulate the geometry of the master win‐
198       dows or the parents of slave windows (i.e. it doesn't set their
199       requested sizes).  To control the sizes of these windows, make them
200       windows like frames and canvases that provide configuration options for
201       this purpose.
202

SEE ALSO

204       Tk::form Tk::grid Tk::pack
205

KEYWORDS

207       geometry manager, height, location, master, place, rubber sheet, slave,
208       width
209
210
211
212perl v5.8.8                       2008-02-05                          place(3)
Impressum