.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "place 3" .TH place 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::place \- Geometry manager for fixed or rubber\-sheet placement .SH SYNOPSIS .IX Header "SYNOPSIS" \ \ \ \fR\f(CI$widget\fR\fI\fR\->\fBplace\fR?(\fI\-option\fR=>\fIvalue\fR?, \fI\-option\fR=>\fIvalue\fR, ...)? .PP \ \ \ \fR\f(CI$widget\fR\fI\fR\->\fBplaceForget\fR .PP \ \ \ \fR\f(CI$widget\fR\fI\fR\->\fBplaceInfo\fR .PP \ \ \ \fR\f(CI$master\fR\fI\fR\->\fBplaceSlaves\fR .SH DESCRIPTION .IX Header "DESCRIPTION" 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 \fIslave\fR, within another window, called the \fImaster\fR. 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. .ie n .IP "\fR\fI$slave\fR\fI\fR\->\fBplace\fR?(\fI\-option\fR=>\fIvalue\fR?, \fI\-option\fR=>\fIvalue\fR, ...?)?" 4 .el .IP "\fR\f(CI$slave\fR\fI\fR\->\fBplace\fR?(\fI\-option\fR=>\fIvalue\fR?, \fI\-option\fR=>\fIvalue\fR, ...?)?" 4 .IX Item "$slave->place?(-option=>value?, -option=>value, ...?)?" The \fBplace\fR method arranges for the placer to manage the geometry of \fR\f(CI$slave\fR\fI\fR. The remaining arguments consist of one or more \fI\-option\fR=>\fIvalue\fR pairs that specify the way in which \fI\fR\f(CI$slave\fR\fI\fR's geometry is managed. \fI\-option\fR may have any of the values accepted by the placeConfigure method. .Sp The \fBplace\fR method returns \fR\f(CI$slave\fR\fI\fR. .ie n .IP "\fR\fI$slave\fR\fI\fR\->\fBplaceConfigure\fR?(\fI\-option\fR=>\fIvalue\fR?, \fI\-option\fR=>\fIvalue\fR, ...?)?" 4 .el .IP "\fR\f(CI$slave\fR\fI\fR\->\fBplaceConfigure\fR?(\fI\-option\fR=>\fIvalue\fR?, \fI\-option\fR=>\fIvalue\fR, ...?)?" 4 .IX Item "$slave->placeConfigure?(-option=>value?, -option=>value, ...?)?" Query or modify the geometry options of the \fR\f(CI$slave\fR\fI\fR. If no option is specified, this method returns a list describing the available options (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the method modifies the given option(s) to have the given value(s); in this case the command returns \f(CW\*(C`undef\*(C'\fR. .Sp The following \fI\-option\fR=>\fIvalue\fR pairs are supported: .RS 4 .IP "\fB\-anchor\fR => \fIwhere\fR" 8 .IX Item "-anchor => where" \&\fIWhere\fR specifies which point of \fR\f(CI$slave\fR\fI\fR is to be positioned at the (x,y) location selected by the \fB\-x\fR, \fB\-y\fR, \&\fB\-relx\fR, and \fB\-rely\fR options. The anchor point is in terms of the outer area of \fI\fR\f(CI$slave\fR\fI\fR including its border, if any. Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of \&\fI\fR\f(CI$slave\fR\fI\fR's border will appear at the given (x,y) location in the master. The anchor position defaults to \fBnw\fR. .IP "\fB\-bordermode\fR => \fImode\fR" 8 .IX Item "-bordermode => mode" \&\fIMode\fR 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 \fBinside\fR. 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 \fB\-x\fR=>\fB0\fR corresponds to an x\-coordinate just inside the border and an option of \fB\-relwidth\fR=>1.0 means \fR\f(CI$slave\fR\fI\fR will fill the area inside the master's border. If \fImode\fR is \fBoutside\fR then the placer considers the area of the master to include its border; this mode is typically used when placing \fI\fR\f(CI$slave\fR\fI\fR outside its master, as with the options \&\fB\-x\fR=>\fB0\fR, \fB\-y\fR=>\fB0\fR, \fB\-anchor\fR=>\fBne\fR. Lastly, \fImode\fR may be specified as \fBignore\fR, 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 \fBignore\fR is probably not very useful. .IP "\fB\-height\fR => \fIsize\fR" 8 .IX Item "-height => size" \&\fISize\fR specifies the height for \fR\f(CI$slave\fR\fI\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The height will be the outer dimension of \fI\fR\f(CI$slave\fR\fI\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-height\fR or \&\fB\-relheight\fR option is specified, then the height requested internally by the window will be used. .ie n .IP "\fB\-in\fR => \fR\fI$master\fR\fI\fR" 8 .el .IP "\fB\-in\fR => \fR\f(CI$master\fR\fI\fR" 8 .IX Item "-in => $master" \&\fR\f(CI$master\fR\fI\fR is the reference to the window relative to which \fI\fR\f(CI$slave\fR\fI\fR is to be placed. \&\fI\fR\f(CI$master\fR\fI\fR must either be \fI\fR\f(CI$slave\fR\fI\fR's parent or a descendant of \fI\fR\f(CI$slave\fR\fI\fR's parent. In addition, \fI\fR\f(CI$master\fR\fI\fR and \fI\fR\f(CI$slave\fR\fI\fR must both be descendants of the same top-level window. These restrictions are necessary to guarantee that \fI\fR\f(CI$slave\fR\fI\fR is visible whenever \fI\fR\f(CI$master\fR\fI\fR is visible. If this option isn't specified then the master defaults to \&\fI\fR\f(CI$slave\fR\fI\fR's parent. .IP "\fB\-relheight\fR => \fIsize\fR" 8 .IX Item "-relheight => size" \&\fISize\fR specifies the height for \fR\f(CI$slave\fR\fI\fR. In this case the height is specified as a floating-point number relative to the height of the master: 0.5 means \fI\fR\f(CI$slave\fR\fI\fR will be half as high as the master, 1.0 means \fI\fR\f(CI$slave\fR\fI\fR will have the same height as the master, and so on. If both \fB\-height\fR and \fB\-relheight\fR are specified for a slave, their values are summed. For example, \fB\-relheight\fR=>1.0, \fB\-height\fR=>\-2 makes the slave 2 pixels shorter than the master. .IP "\fB\-relwidth\fR => \fIsize\fR" 8 .IX Item "-relwidth => size" \&\fISize\fR specifies the width for \fR\f(CI$slave\fR\fI\fR. In this case the width is specified as a floating-point number relative to the width of the master: 0.5 means \fI\fR\f(CI$slave\fR\fI\fR will be half as wide as the master, 1.0 means \fI\fR\f(CI$slave\fR\fI\fR will have the same width as the master, and so on. If both \fB\-width\fR and \fB\-relwidth\fR are specified for a slave, their values are summed. For example, \fB\-relwidth\fR=>1.0, \fB\-width\fR=>5 makes the slave 5 pixels wider than the master. .IP "\fB\-relx\fR => \fIlocation\fR" 8 .IX Item "-relx => location" \&\fILocation\fR specifies the x\-coordinate within the master window of the anchor point for \fR\f(CI$slave\fR\fI\fR 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. \&\fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-x\fR and \fB\-relx\fR are specified for a slave then their values are summed. For example, "\fB\-relx\fR=>0.5, \fB\-x\fR=\-2" positions the left edge of the slave 2 pixels to the left of the center of its master. .IP "\fB\-rely\fR => \fIlocation\fR" 8 .IX Item "-rely => location" \&\fILocation\fR specifies the y\-coordinate within the master window of the anchor point for \fR\f(CI$slave\fR\fI\fR 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. \&\fILocation\fR need not be in the range 0.0\-1.0. If both \fB\-y\fR and \fB\-rely\fR are specified for a slave then their values are summed. For example, \fB\-rely\fR=>0.5, \fB\-x\fR=>3 positions the top edge of the slave 3 pixels below the center of its master. .IP "\fB\-width\fR => \fIsize\fR" 8 .IX Item "-width => size" \&\fISize\fR specifies the width for \fR\f(CI$slave\fR\fI\fR in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR). The width will be the outer width of \fI\fR\f(CI$slave\fR\fI\fR including its border, if any. If \fIsize\fR is an empty string, or if no \fB\-width\fR or \fB\-relwidth\fR option is specified, then the width requested internally by the window will be used. .IP "\fB\-x\fR => \fIlocation\fR" 8 .IX Item "-x => location" \&\fILocation\fR specifies the x\-coordinate within the master window of the anchor point for \fR\f(CI$slave\fR\fI\fR widget. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the master window. .IP "\fB\-y\fR => \fIlocation\fR" 8 .IX Item "-y => location" \&\fILocation\fR specifies the y\-coordinate within the master window of the anchor point for \fR\f(CI$slave\fR\fI\fR widget. The location is specified in screen units (i.e. any of the forms accepted by \fBTk_GetPixels\fR) and need not lie within the bounds of the master window. .RE .RS 4 .Sp If the same value is specified separately with two different options, such as \fB\-x\fR and \fB\-relx\fR, then the most recent option is used and the older one is ignored. .RE .ie n .IP \fR\fI$slave\fR\fI\fR\->\fBplaceForget\fR 4 .el .IP \fR\f(CI$slave\fR\fI\fR\->\fBplaceForget\fR 4 .IX Item "$slave->placeForget" The \fBplaceForget\fR method causes the placer to stop managing the geometry of \fR\f(CI$slave\fR\fI\fR. As a side effect of this method call \&\fI\fR\f(CI$slave\fR\fI\fR will be unmapped so that it doesn't appear on the screen. If \fI\fR\f(CI$slave\fR\fI\fR isn't currently managed by the placer then the method call has no effect. \&\fBplaceForget\fR returns an empty string as result. .ie n .IP \fR\fI$slave\fR\fI\fR\->\fBplaceInfo\fR 4 .el .IP \fR\f(CI$slave\fR\fI\fR\->\fBplaceInfo\fR 4 .IX Item "$slave->placeInfo" The \fBplaceInfo\fR method returns a list giving the current configuration of \fR\f(CI$slave\fR\fI\fR. The list consists of \fI\-option\fR=>\fIvalue\fR pairs in exactly the same form as might be specified to the \fBplace\fR method. .ie n .IP \fR\fI$slave\fR\fI\fR\->\fBplaceSlaves\fR 4 .el .IP \fR\f(CI$slave\fR\fI\fR\->\fBplaceSlaves\fR 4 .IX Item "$slave->placeSlaves" The \fBplaceSlaves\fR method returns a list of all the slave windows for which \fR\f(CI$master\fR\fI\fR is the master. If there are no slaves for \fI\fR\f(CI$master\fR\fI\fR then an empty list is returned. .PP If the configuration of a window has been retrieved with \&\fBplaceInfo\fR, that configuration can be restored later by first using \fBplaceForget\fR to erase any existing information for the window and then invoking \fBplace\fR with the saved information. .SH "FINE POINTS" .IX Header "FINE POINTS" 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 ``\fIreal children\fR'' 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 ``\fIreal children\fR'' 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. .PP 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 .PP \ \ \ \ \fB\-in\fR=>\fR\f(CI$sibling\fR\fI\fR, \fB\-relx\fR=>0.5, \fB\-rely\fR=>1.0, \&\fB\-anchor\fR=>'n', \fB\-bordermode\fR=>'outside' .PP Whenever the \fR\f(CI$sibling\fR\fI\fR widget is repositioned in the future, the slave will be repositioned as well. .PP 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. .SH "SEE ALSO" .IX Header "SEE ALSO" Tk::form, Tk::grid, Tk::pack .SH KEYWORDS .IX Header "KEYWORDS" geometry manager, height, location, master, place, rubber sheet, slave, width