📄 place.n
字号:
'\"'\" Copyright (c) 1992 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) place.n 1.13 96/08/27 13:21:49'\" .so man.macros.TH place n "" Tk "Tk Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEplace \- Geometry manager for fixed or rubber-sheet placement.SH SYNOPSIS\fBplace \fIwindow option value \fR?\fIoption value ...\fR?.sp\fBplace configure \fIwindow option value \fR?\fIoption value ...\fR?.sp\fBplace forget \fIwindow\fR.sp\fBplace info \fIwindow\fR.sp\fBplace slaves \fIwindow\fR.BE.SH DESCRIPTION.PPThe placer is a geometry manager for Tk.It provides simple fixed placement of windows, where you specifythe 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 thesize and location of the slave in terms of the dimensions ofthe master, so that the slave changes size and locationin response to changes in the size of the master.Lastly, the placer allows you to mix these styles of placement sothat, for example, the slave has a fixed width and height but iscentered inside the master..PPIf the first argument to the \fBplace\fR command is a window pathname or \fBconfigure\fR then the command arranges for the placerto manage the geometry of a slave whose path name is \fIwindow\fR.The remaining arguments consist of one or more \fIoption\-value\fRpairs that specify the way in which \fIwindow\fR'sgeometry is managed.If the placer is already managing \fIwindow\fR, then the\fIoption\-value\fR pairs modify the configuration for \fIwindow\fR.In this form the \fBplace\fR command returns an empty string as result.The following \fIoption\-value\fR pairs are supported:.TP\fB\-in \fImaster\fR\fIMaster\fR specifes the path name of the window relativeto which \fIwindow\fR is to be placed.\fIMaster\fR must either be \fIwindow\fR's parent or a descendantof \fIwindow\fR's parent.In addition, \fImaster\fR and \fIwindow\fR must both be descendantsof the same top-level window.These restrictions are necessary to guaranteethat \fIwindow\fR is visible whenever \fImaster\fR is visible.If this option isn't specified then the master defaults to\fIwindow\fR's parent..TP\fB\-x \fIlocation\fR\fILocation\fR specifies the x-coordinate within the master windowof the anchor point for \fIwindow\fR.The location is specified in screen units (i.e. any of the formsaccepted by \fBTk_GetPixels\fR) and need not lie within the boundsof the master window..TP\fB\-relx \fIlocation\fR\fILocation\fR specifies the x-coordinate within the master windowof the anchor point for \fIwindow\fR.In this case the location is specified in a relative fashionas a floating-point number: 0.0 corresponds to the left edgeof 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 slavethen their values are summed. For example, \fB\-relx 0.5 \-x \-2\fRpositions the left edge of the slave 2 pixels to the left of thecenter of its master..TP\fB\-y \fIlocation\fR\fILocation\fR specifies the y-coordinate within the master windowof the anchor point for \fIwindow\fR.The location is specified in screen units (i.e. any of the formsaccepted by \fBTk_GetPixels\fR) and need not lie within the boundsof the master window..TP\fB\-rely \fIlocation\fR\fILocation\fR specifies the y-coordinate within the master windowof the anchor point for \fIwindow\fR.In this case the value is specified in a relative fashionas a floating-point number: 0.0 corresponds to the top edgeof 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 slavethen their values are summed. For example, \fB\-rely 0.5 \-x 3\fRpositions the top edge of the slave 3 pixels below thecenter of its master..TP\fB\-anchor \fIwhere\fR\fIWhere\fR specifies which point of \fIwindow\fR is to be positionedat 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 \fIwindow\fRincluding its border, if any.Thus if \fIwhere\fR is \fBse\fR then the lower-right corner of\fIwindow\fR's border will appear at the given (x,y) locationin the master.The anchor position defaults to \fBnw\fR..TP\fB\-width \fIsize\fR\fISize\fR specifies the width for \fIwindow\fR in screen units(i.e. any of the forms accepted by \fBTk_GetPixels\fR).The width will be the outer width of \fIwindow\fR including itsborder, if any.If \fIsize\fR is an empty string, or if no \fB\-width\fRor \fB\-relwidth\fR option is specified, then the width requestedinternally by the window will be used..TP\fB\-relwidth \fIsize\fR\fISize\fR specifies the width for \fIwindow\fR.In this case the width is specified as a floating-point numberrelative to the width of the master: 0.5 means \fIwindow\fR willbe half as wide as the master, 1.0 means \fIwindow\fR will havethe 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 1.0 \-width 5\fRmakes the slave 5 pixels wider than the master..TP\fB\-height \fIsize\fR\fISize\fR specifies the height for \fIwindow\fR in screen units(i.e. any of the forms accepted by \fBTk_GetPixels\fR).The height will be the outer dimension of \fIwindow\fR including itsborder, 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 requestedinternally by the window will be used..TP\fB\-relheight \fIsize\fR\fISize\fR specifies the height for \fIwindow\fR.In this case the height is specified as a floating-point numberrelative to the height of the master: 0.5 means \fIwindow\fR willbe half as high as the master, 1.0 means \fIwindow\fR will havethe 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 1.0 \-height \-2\fRmakes the slave 2 pixels shorter than the master..TP\fB\-bordermode \fImode\fR\fIMode\fR determines the degree to which borders within themaster 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 tobe the innermost area of the master, inside any border:an option of \fB\-x 0\fR corresponds to an x-coordinate justinside the border and an option of \fB\-relwidth 1.0\fRmeans \fIwindow\fR will fill the area inside the master'sborder.If \fImode\fR is \fBoutside\fR then the placer considersthe area of the master to include its border;this mode is typically used when placing \fIwindow\fRoutside its master, as with the options \fB\-x 0 \-y 0 \-anchor ne\fR.Lastly, \fImode\fR may be specified as \fBignore\fR, in whichcase borders are ignored: the area of the master is consideredto be its official X area, which includes any internal border butno external border. A bordermode of \fBignore\fR is probablynot very useful..PPIf the same value is specified separately withtwo different options, such as \fB\-x\fR and \fB\-relx\fR, thenthe most recent option is used and the older one is ignored..PPThe \fBplace slaves\fR command returns a list of all the slavewindows for which \fIwindow\fR is the master.If there are no slaves for \fIwindow\fR then an empty string isreturned..PPThe \fBplace forget\fR command causes the placer to stop managingthe geometry of \fIwindow\fR. As a side effect of this command\fIwindow\fR will be unmapped so that it doesn't appear on thescreen.If \fIwindow\fR isn't currently managed by the placer then thecommand has no effect.\fBPlace forget\fR returns an empty string as result..PPThe \fBplace info\fR command returns a list giving the currentconfiguration of \fIwindow\fR.The list consists of \fIoption\-value\fR pairs in exactly thesame form as might be specified to the \fBplace configure\fRcommand.If the configuration of a window has been retrieved with\fBplace info\fR, that configuration can be restored later byfirst using \fBplace forget\fR to erase any existing informationfor the window and then invoking \fBplace configure\fR withthe saved information..SH "FINE POINTS".PPIt is not necessary for the master window to be the parentof the slave window.This feature is useful in at least two situations.First, for complex window layouts it means you can create ahierarchy of subwindows whose only purposeis to assist in the layout of the parent.The ``real children'' of the parent (i.e. the windows thatare significant for the application's user interface) can bechildren of the parent yet be placed inside the windowsof the geometry-management hierarchy.This means that the path names of the ``real children''don't reflect the geometry-management hierarchy and userscan specify options for the real childrenwithout being aware of the structure of the geometry-managementhierarchy..PPA second reason for having a master different than the slave'sparent is to tie two siblings together.For example, the placer can be used to force a window always tobe positioned centered just below one of itssiblings by specifying the configuration.CS\fB\-in \fIsibling\fB \-relx 0.5 \-rely 1.0 \-anchor n \-bordermode outside\fR.CEWhenever the sibling is repositioned in the future, the slavewill be repositioned as well..PPUnlike many other geometry managers (such as the packer)the placer does not make any attempt to manipulate the geometry ofthe master windows or the parents of slave windows (i.e. it doesn'tset their requested sizes).To control the sizes of these windows, make them windows likeframes and canvases that provide configuration options for this purpose..SH KEYWORDSgeometry manager, height, location, master, place, rubber sheet, slave, width
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -