 |
|
| |
pod::Prima::Widget::place(3) |
User Contributed Perl Documentation |
pod::Prima::Widget::place(3) |
Prima::Widget::place - Geometry manager for fixed or rubber-sheet
placement
$widget->place(option=>value?, option=>value, ...)
$widget->placeForget;
$widget->placeInfo(option=>value?, option=>value, ...);
$widget->geometry( gt::Place);
$master->placeSlaves
The placer is a geometry manager from Tk. It provides simple fixed
placement of windows, where you specify the exact size and location of one
window, called the slave, within another window, called the
$master. 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.
- place %OPTIONS
- The place method arranges for the placer to manage the geometry of
$slave. The remaining arguments
consist of one or more option=>value pairs that specify
the way in which $slave's
geometry is managed. If the placer is already managing
$slave, then the
option=>value pairs modify the configuration for
$slave. The place
method returns an empty string as result. The following
option=>value pairs are supported:
- in =>
$master
- $master is the reference to the
window relative to which
$slave is to be placed.
$master must neither be
$slave's child nor be present
in a slaves list that directly or indirectly refers to the
$slave.
If this option isn't specified then the master defaults to
$slave's owner.
- x =>
location
- Location specifies the x-coordinate within the master window of the
anchor point for $slave widget.
- relx =>
location
- Location specifies the x-coordinate within the master window of the
anchor point for $slave widget. 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. Location need not
be in the range 0.0-1.0. If both x and relx are specified
for a slave then their values are summed. For example,
"relx=>0.5, x=-2" positions the left edge of
the slave 2 pixels to the left of the center of its master.
- y =>
location
- Location specifies the y-coordinate within the master window of the
anchor point for $slave widget.
- rely =>
location
- Location specifies the y-coordinate within the master window of the
anchor point for $slave widget. 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. Location need not be in the range
0.0-1.0. If both y and rely are specified for a slave then
their values are summed. For example, rely=>0.5, x=>3
positions the top edge of the slave 3 pixels below the center of its
master.
- anchor =>
where
- Where specifies which point of
$slave is to be positioned at the
(x,y) location selected by the x, y, relx, and
rely options. Thus if where is se then the
lower-right corner of
$slave's border will appear
at the given (x,y) location in the master. The anchor position defaults to
nw.
- width =>
size
- Size specifies the width for
$slave. If size is an empty
string, or if no width or relwidth option is specified, then
the width requested internally by the window will be used.
- relwidth =>
size
- Size specifies the width for
$slave. In this case the width is
specified as a floating-point number relative to the width of the master:
0.5 means $slave will be half
as wide as the master, 1.0 means
$slave will have the same
width as the master, and so on. If both width and relwidth
are specified for a slave, their values are summed. For example,
relwidth=>1.0, width=>5 makes the slave 5 pixels wider
than the master.
- height =>
size
- Size specifies the height for
$slave. If size is an empty
string, or if no height or relheight option is specified,
then the height requested internally by the window will be used.
- relheight
=> size
- Size specifies the height for
$slave. In this case the height is
specified as a floating-point number relative to the height of the master:
0.5 means $slave will be half
as high as the master, 1.0 means
$slave will have the same
height as the master, and so on. If both height and
relheight are specified for a slave, their values are summed. For
example, relheight=>1.0, height=>-2 makes the slave 2
pixels shorter than the master.
- placeSlaves
- The placeSlaves method returns a list of all the slave windows for
which $master is the master. If
there are no slaves for
$master then an empty list is
returned.
- placeForget
- The placeForget method causes the placer to stop managing the
geometry of $slave. If
$slave isn't currently
managed by the placer then the method call has no effect.
- placeInfo
%OPTIONS
- In get-mode the placeInfo method returns a list giving the current
configuration of $slave. The list
consists of option=>value pairs in exactly the same form
as might be specified to the place method. If the configuration of
a window has been retrieved with placeInfo, that configuration can
be restored later by first using placeInfo in set-mode and setting
geometry to "gt::Place", which is
equivalent to a direct call to place.
It is not necessary for the master window to be the owner 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 owner. The ``real
children'' of the owner (i.e. the windows that are significant for the
application's user interface) can be children of the owner 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.
A second reason for having a master different than the slave's
owner 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
in=>$sibling,
relx=>0.5, rely=>1.0, anchor=>'n'
Whenever the $sibling widget
is repositioned in the future, the slave will be repositioned as well.
Unlike the other geometry managers (such as the packer) the placer
does not make any attempt to manipulate the geometry of the master windows
or the owners of slave windows (i.e. it doesn't set their requested
sizes).
Prima, Prima::Widget
Tk::place Tk::pack
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc.
|