home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>Tk::place - Geometry manager for fixed or rubber-sheet placement</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::place - Geometry manager for fixed or rubber-sheet placement</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#fine points">FINE POINTS</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- <LI><A HREF="#keywords">KEYWORDS</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Tk::place - Geometry manager for fixed or rubber-sheet placement</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P> <EM>$widget</EM>-><STRONG>place</STRONG>?(<EM>-option</EM>=><EM>value</EM>?, <EM>-option</EM>=><EM>value</EM>, ...)?</P>
- <P> <EM>$widget</EM>-><STRONG>placeForget</STRONG></P>
- <P> <EM>$widget</EM>-><STRONG>placeInfo</STRONG></P>
- <P> <EM>$master</EM>-><STRONG>placeSlaves</STRONG></P>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <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 <EM>slave</EM>,
- within another window, called the <EM>$master</EM>.
- 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>
- <DL>
- <DT><STRONG><A NAME="item_place"><EM>$slave</EM>-><STRONG>place</STRONG>?(<EM>-option</EM>=><EM>value</EM>?, <EM>-option</EM>=><EM>value</EM>, ...?)?</A></STRONG><BR>
- <DD>
- The <STRONG>place</STRONG> method arranges for the placer
- to manage the geometry of <EM>$slave</EM>.
- The remaining arguments consist of one or more <EM>-option</EM>=><EM>value</EM>
- pairs that specify the way in which <EM>$slave</EM>'s
- geometry is managed.
- If the placer is already managing <EM>$slave</EM>, then the
- <EM>-option</EM>=><EM>value</EM> pairs modify the configuration for <EM>$slave</EM>.
- The <STRONG>place</STRONG> method returns an empty string as result.
- The following <EM>-option</EM>=><EM>value</EM> pairs are supported:
- <DL>
- <DT><STRONG><A NAME="item_%2Din_%3D%3E_%24master"><STRONG>-in</STRONG> => <EM>$master</EM></A></STRONG><BR>
- <DD>
- <EM>$master</EM> is the reference to the window relative
- to which <EM>$slave</EM> is to be placed.
- <EM>$master</EM> must either be <EM>$slave</EM>'s parent or a descendant
- of <EM>$slave</EM>'s parent.
- In addition, <EM>$master</EM> and <EM>$slave</EM> must both be descendants
- of the same top-level window.
- These restrictions are necessary to guarantee
- that <EM>$slave</EM> is visible whenever <EM>$master</EM> is visible.
- If this option isn't specified then the master defaults to
- <EM>$slave</EM>'s parent.
- <P></P>
- <DT><STRONG><A NAME="item_%2Dx_%3D%3E_location"><STRONG>-x</STRONG> => <EM>location</EM></A></STRONG><BR>
- <DD>
- <EM>Location</EM> specifies the x-coordinate within the master window
- of the anchor point for <EM>$slave</EM> widget.
- The location is specified in screen units (i.e. any of the forms
- accepted by <STRONG>Tk_GetPixels</STRONG>) and need not lie within the bounds
- of the master window.
- <P></P>
- <DT><STRONG><A NAME="item_%2Drelx_%3D%3E_location"><STRONG>-relx</STRONG> => <EM>location</EM></A></STRONG><BR>
- <DD>
- <EM>Location</EM> specifies the x-coordinate within the master window
- of the anchor point for <EM>$slave</EM> 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.
- <EM>Location</EM> need not be in the range 0.0-1.0.
- If both <STRONG>-x</STRONG> and <STRONG>-relx</STRONG> are specified for a slave
- then their values are summed. For example, ``<STRONG>-relx</STRONG>=>0.5, <STRONG>-x</STRONG>=-2''
- positions the left edge of the slave 2 pixels to the left of the
- center of its master.
- <P></P>
- <DT><STRONG><A NAME="item_%2Dy_%3D%3E_location"><STRONG>-y</STRONG> => <EM>location</EM></A></STRONG><BR>
- <DD>
- <EM>Location</EM> specifies the y-coordinate within the master window
- of the anchor point for <EM>$slave</EM> widget.
- The location is specified in screen units (i.e. any of the forms
- accepted by <STRONG>Tk_GetPixels</STRONG>) and need not lie within the bounds
- of the master window.
- <P></P>
- <DT><STRONG><A NAME="item_%2Drely_%3D%3E_location"><STRONG>-rely</STRONG> => <EM>location</EM></A></STRONG><BR>
- <DD>
- <EM>Location</EM> specifies the y-coordinate within the master window
- of the anchor point for <EM>$slave</EM> 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.
- <EM>Location</EM> need not be in the range 0.0-1.0.
- If both <STRONG>-y</STRONG> and <STRONG>-rely</STRONG> are specified for a slave
- then their values are summed. For example, <STRONG>-rely</STRONG>=>0.5, <STRONG>-x</STRONG>=>3
- positions the top edge of the slave 3 pixels below the
- center of its master.
- <P></P>
- <DT><STRONG><A NAME="item_%2Danchor_%3D%3E_where"><STRONG>-anchor</STRONG> => <EM>where</EM></A></STRONG><BR>
- <DD>
- <EM>Where</EM> specifies which point of <EM>$slave</EM> is to be positioned
- at the (x,y) location selected by the <STRONG>-x</STRONG>, <STRONG>-y</STRONG>,
- <STRONG>-relx</STRONG>, and <STRONG>-rely</STRONG> options.
- The anchor point is in terms of the outer area of <EM>$slave</EM>
- including its border, if any.
- Thus if <EM>where</EM> is <STRONG>se</STRONG> then the lower-right corner of
- <EM>$slave</EM>'s border will appear at the given (x,y) location
- in the master.
- The anchor position defaults to <STRONG>nw</STRONG>.
- <P></P>
- <DT><STRONG><A NAME="item_%2Dwidth_%3D%3E_size"><STRONG>-width</STRONG> => <EM>size</EM></A></STRONG><BR>
- <DD>
- <EM>Size</EM> specifies the width for <EM>$slave</EM> in screen units
- (i.e. any of the forms accepted by <STRONG>Tk_GetPixels</STRONG>).
- The width will be the outer width of <EM>$slave</EM> including its
- border, if any.
- If <EM>size</EM> is an empty string, or if no <STRONG>-width</STRONG>
- or <STRONG>-relwidth</STRONG> option is specified, then the width requested
- internally by the window will be used.
- <P></P>
- <DT><STRONG><A NAME="item_%2Drelwidth_%3D%3E_size"><STRONG>-relwidth</STRONG> => <EM>size</EM></A></STRONG><BR>
- <DD>
- <EM>Size</EM> specifies the width for <EM>$slave</EM>.
- In this case the width is specified as a floating-point number
- relative to the width of the master: 0.5 means <EM>$slave</EM> will
- be half as wide as the master, 1.0 means <EM>$slave</EM> will have
- the same width as the master, and so on.
- If both <STRONG>-width</STRONG> and <STRONG>-relwidth</STRONG> are specified for a slave,
- their values are summed. For example, <STRONG>-relwidth</STRONG>=>1.0, <STRONG>-width</STRONG>=>5
- makes the slave 5 pixels wider than the master.
- <P></P>
- <DT><STRONG><A NAME="item_%2Dheight_%3D%3E_size"><STRONG>-height</STRONG> => <EM>size</EM></A></STRONG><BR>
- <DD>
- <EM>Size</EM> specifies the height for <EM>$slave</EM> in screen units
- (i.e. any of the forms accepted by <STRONG>Tk_GetPixels</STRONG>).
- The height will be the outer dimension of <EM>$slave</EM> including its
- border, if any.
- If <EM>size</EM> is an empty string, or if no <STRONG>-height</STRONG> or
- <STRONG>-relheight</STRONG> option is specified, then the height requested
- internally by the window will be used.
- <P></P>
- <DT><STRONG><A NAME="item_%2Drelheight_%3D%3E_size"><STRONG>-relheight</STRONG> => <EM>size</EM></A></STRONG><BR>
- <DD>
- <EM>Size</EM> specifies the height for <EM>$slave</EM>.
- In this case the height is specified as a floating-point number
- relative to the height of the master: 0.5 means <EM>$slave</EM> will
- be half as high as the master, 1.0 means <EM>$slave</EM> will have
- the same height as the master, and so on.
- If both <STRONG>-height</STRONG> and <STRONG>-relheight</STRONG> are specified for a slave,
- their values are summed. For example, <STRONG>-relheight</STRONG>=>1.0, <STRONG>-height</STRONG>=>-2
- makes the slave 2 pixels shorter than the master.
- <P></P>
- <DT><STRONG><A NAME="item_%2Dbordermode_%3D%3E_mode"><STRONG>-bordermode</STRONG> => <EM>mode</EM></A></STRONG><BR>
- <DD>
- <EM>Mode</EM> 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 <STRONG>inside</STRONG>.
- 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 <STRONG>-x</STRONG>=><STRONG>0</STRONG> corresponds to an x-coordinate just
- inside the border and an option of <STRONG>-relwidth</STRONG>=>1.0
- means <EM>$slave</EM> will fill the area inside the master's
- border.
- If <EM>mode</EM> is <STRONG>outside</STRONG> then the placer considers
- the area of the master to include its border;
- this mode is typically used when placing <EM>$slave</EM>
- outside its master, as with the options
- <STRONG>-x</STRONG>=><STRONG>0</STRONG>, <STRONG>-y</STRONG>=><STRONG>0</STRONG>, <STRONG>-anchor</STRONG>=><STRONG>ne</STRONG>.
- Lastly, <EM>mode</EM> may be specified as <STRONG>ignore</STRONG>, 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 <STRONG>ignore</STRONG> is probably
- not very useful.
- <P>If the same value is specified separately with
- two different options, such as <STRONG>-x</STRONG> and <STRONG>-relx</STRONG>, then
- the most recent option is used and the older one is ignored.</P>
- <P></P></DL>
- <DT><STRONG><A NAME="item_placeSlaves"><EM>$slave</EM>-><STRONG>placeSlaves</STRONG></A></STRONG><BR>
- <DD>
- The <STRONG>placeSlaves</STRONG> method returns a list of all the slave
- windows for which <EM>$master</EM> is the master.
- If there are no slaves for <EM>$master</EM> then an empty list is
- returned.
- <P></P>
- <DT><STRONG><A NAME="item_placeForget"><EM>$slave</EM>-><STRONG>placeForget</STRONG></A></STRONG><BR>
- <DD>
- The <STRONG>placeForget</STRONG> method causes the placer to stop managing
- the geometry of <EM>$slave</EM>. As a side effect of this method call
- <EM>$slave</EM> will be unmapped so that it doesn't appear on the
- screen.
- If <EM>$slave</EM> isn't currently managed by the placer then the
- method call has no effect.
- <STRONG>placeForget</STRONG> returns an empty string as result.
- <P></P>
- <DT><STRONG><A NAME="item_placeInfo"><EM>$slave</EM>-><STRONG>placeInfo</STRONG></A></STRONG><BR>
- <DD>
- The <STRONG>placeInfo</STRONG> method returns a list giving the current
- configuration of <EM>$slave</EM>.
- The list consists of <EM>-option</EM>=><EM>value</EM> pairs in exactly the
- same form as might be specified to the <STRONG>place</STRONG>
- method.
- If the configuration of a window has been retrieved with
- <STRONG>placeInfo</STRONG>, that configuration can be restored later by
- first using <STRONG>placeForget</STRONG> to erase any existing information
- for the window and then invoking <STRONG>place</STRONG> with
- the saved information.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="fine points">FINE POINTS</A></H1>
- <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 ``<EM>real children</EM>'' 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 ``<EM>real children</EM>''
- 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>
- <P> <STRONG>-in</STRONG>=><EM>$sibling</EM>, <STRONG>-relx</STRONG>=>0.5, <STRONG>-rely</STRONG>=>1.0,
- <STRONG>-anchor</STRONG>=>'n', <STRONG>-bordermode</STRONG>=>'outside'</P>
- <P>Whenever the <EM>$sibling</EM> widget 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>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P><A HREF="../../../site/lib/Tk/form.html">Tk::form</A>
- <A HREF="../../../site/lib/Tk/grid.html">Tk::grid</A>
- <A HREF="../../../site/lib/Tk/pack.html">Tk::pack</A></P>
- <P>
- <HR>
- <H1><A NAME="keywords">KEYWORDS</A></H1>
- <P>geometry manager, height, location, master, place, rubber sheet, slave, width</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> Tk::place - Geometry manager for fixed or rubber-sheet placement</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-