stk/Help/wm.n.html

514 lines
28 KiB
HTML

<HTML><HEAD><TITLE>Tk Built-In Commands - wm manual page</TITLE></HEAD>
<BR>
<BODY bgcolor = #c3c3ff>
<H2><IMG ALIGN=BOTTOM SRC="./Img/ManPageBlue.gif"> wm</H2>
<I>Communicate with window manager</I><P><IMG ALIGN=TOP SRC="./Img/line-red.gif">
<H3><A NAME="M2">SYNOPSIS</A></H3>
(<B>wm</B> <I>option window </I>?<I>args</I>?)<BR>
<H3><A NAME="M3">DESCRIPTION</A></H3>
The <B>wm</B> procedure is used to interact with window managers in
order to control such things as the title for a window, its geometry,
or the increments in terms of which it may be resized. The <B>wm</B>
procedure can take any of a number of different forms, depending on
the <I>option</I> argument. All of the forms expect at least one
additional argument, <I>window</I>, which must be the path name of a
top-level window.
<P>
The legal forms for the <B>wm</B> procedure are:
<P>
<DL>
<DT><A NAME="M4">(<B>wm 'aspect </B><I>window</I> ?<I>minNumer minDenom maxNumer maxDenom</I>?)</A><DD>
If <I>minNumer</I>, <I>minDenom</I>, <I>maxNumer</I>, and <I>maxDenom</I>
are all specified, then they will be passed to the window manager
and the window manager should use them to enforce a range of
acceptable aspect ratios for <I>window</I>. The aspect ratio of
<I>window</I> (width/length) will be constrained to lie
between <I>minNumer</I>/<I>minDenom</I> and <I>maxNumer</I>/<I>maxDenom</I>.
If <I>minNumer</I> etc. are all specified as empty strings, then
any existing aspect ratio restrictions are removed.
If <I>minNumer</I> etc. are specified, then the procedure returns an
empty list. Otherwise, it returns
a STk list containing four elements, which are the current values
of <I>minNumer</I>, <I>minDenom</I>, <I>maxNumer</I>, and <I>maxDenom</I>
(if no aspect restrictions are in effect, then an empty list is
returned).
<P>
<DT><A NAME="M5">(<B>wm 'client </B><I>window</I>)</A><DD>
<DT><A NAME="M6">(<B>wm 'client </B><I>window</I> <I>name</I>)</A><DD>
If <I>name</I> is specified, this procedure stores <I>name</I> (which
should be the name of
the host on which the application is executing) in <I>window</I>'s
<B>WM_CLIENT_MACHINE</B> property for use by the window manager or
session manager.
The procedure returns an empty list in this case.
If <I>name</I> isn't specified, the procedure returns the last name
set in a <B>wm client</B> procedure for <I>window</I>.
If <I>name</I> is specified as an empty string, the procedure deletes the
<B>WM_CLIENT_MACHINE</B> property from <I>window</I>.
<P>
<DT><A NAME="M7">(<B>wm 'colormapwindows </B><I>window</I>)</A><DD>
<DT><A NAME="M8">(<B>wm 'colormapwindows </B><I>window</I> <I>windowList</I>)</A><DD>
This procedure is used to manipulate the <B>WM_COLORMAP_WINDOWS</B>
property, which provides information to the window managers about
windows that have private colormaps.
If <I>windowList</I> isn't specified, the procedure returns a list
whose elements are the names of the windows in the <B>WM_COLORMAP_WINDOWS</B>
property.
If <I>windowList</I> is specified, it consists of a list of window
path names; the procedure overwrites the <B>WM_COLORMAP_WINDOWS</B>
property with the given windows and returns an empty list.
The <B>WM_COLORMAP_WINDOWS</B> property should normally contain a
list of the internal windows within <I>window</I> whose colormaps differ
from their parents.
The order of the windows in the property indicates a priority order:
the window manager will attempt to install as many colormaps as possible
from the head of this list when <I>window</I> gets the colormap focus.
If <I>window</I> is not included among the windows in <I>windowList</I>,
Tk implicitly adds it at the end of the <B>WM_COLORMAP_WINDOWS</B>
property, so that its colormap is lowest in priority.
If <B>wm colormapwindows</B> is not invoked, Tk will automatically set
the property for each top-level window to all the internal windows
whose colormaps differ from their parents, followed by the top-level
itself; the order of the internal windows is undefined.
See the ICCCM documentation for more information on the
<B>WM_COLORMAP_WINDOWS</B> property.
<P>
<DT><A NAME="M9">(<B>wm 'command </B><I>window</I>)</A><DD>
<DT><A NAME="M10">(<B>wm 'command </B><I>window</I> <I>value</I>)</A><DD>
If <I>value</I> is specified, this procedure stores <I>value</I> in <I>window</I>'s
<B>WM_COMMAND</B> property for use by the window manager or
session manager and returns an empty list.
<I>Value</I> must have proper list structure; the elements should
contain the words of the procedure used to invoke the application.
If <I>value</I> isn't specified then the procedure returns the last value
set in a <B>wm procedure</B> command for <I>window</I>.
If <I>value</I> is specified as an empty string, the procedure
deletes the <B>WM_COMMAND</B> property from <I>window</I>.
<P>
<DT><A NAME="M11">(<B>wm 'deiconify </B><I>window</I>)</A><DD>
Arrange for <I>window</I> to be displayed in normal (non-iconified) form.
This is done by mapping the window. If the window has never been
mapped then this procedure will not map the window, but it will ensure
that when the window is first mapped it will be displayed
in de-iconified form. Returns an empty list.
<P>
<DT><A NAME="M12">(<B>wm 'focusmodel </B><I>window</I>)</A><DD>
<DT><A NAME="M13">(<B>wm 'focusmodel </B><I>window</I> '<B>active</B>)</A><DD>
<DT><A NAME="M14">(<B>wm 'focusmodel </B><I>window</I> '<B>passive</B>)</A><DD>
If <B>active</B> or <B>passive</B> is supplied as an optional argument
to the procedure, then it specifies the focus model for <I>window</I>.
In this case the procedure returns an empty list. If no additional
argument is supplied, then the procedure returns the current focus
model for <I>window</I>.
An <B>active</B> focus model means that <I>window</I> will claim the
input focus for itself or its descendants, even at times when
the focus is currently in some other application. <B>Passive</B> means that
<I>window</I> will never claim the focus for itself: the window manager
should give the focus to <I>window</I> at appropriate times. However,
once the focus has been given to <I>window</I> or one of its descendants,
the application may re-assign the focus among <I>window</I>'s descendants.
The focus model defaults to <B>passive</B>, and Tk's <B><A HREF="./focus.n.html">focus</A></B> procedure
assumes a passive model of focusing.
<P>
<DT><A NAME="M15">(<B>wm 'frame </B><I>window</I>)</A><DD>
If <I>window</I> has been reparented by the window manager into a
decorative frame, the procedure returns the X window identifier for
the outermost frame that contains <I>window</I> (the window whose
parent is the root or virtual root). If <I>window</I> hasn't been
reparented by the window manager then the procedure returns the
X window identifier for <I>window</I>.
<P>
<DT><A NAME="M16">(<B>wm 'geometry </B><I>window</I>)</A><DD>
<DT><A NAME="M17">(<B>wm 'geometry </B><I>window</I> <I>newGeometry</I>)</A><DD>
If <I>newGeometry</I> is specified, then the geometry of <I>window</I>
is changed and an empty list is returned. Otherwise the current
geometry for <I>window</I> is returned (this is the most recent
geometry specified either by manual resizing or
in a <B>wm geometry</B> procedure). <I>NewGeometry</I> has
the form &quot;<B>=</B><I>width</I><B>x</B><I>height</I><B>&#177;</B><I>x</I><B>&#177;</B><I>y</I>&quot;, where
any of <B>=</B>, <I>width</I><B>x</B><I>height</I>, or <B>&#177;</B><I>x</I><B>&#177;</B><I>y</I>
may be omitted. <I>Width</I> and <I>height</I> are positive integers
specifying the desired dimensions of <I>window</I>. If <I>window</I>
is gridded (see GRIDDED GEOMETRY MANAGEMENT below) then the dimensions
are specified in grid units; otherwise they are specified in pixel
units. <I>X</I> and <I>y</I> specify the desired location of
<I>window</I> on the screen, in pixels.
If <I>x</I> is preceded by <B>+</B>, it specifies
the number of pixels between the left edge of the screen and the left
edge of <I>window</I>'s border; if preceded by <B>:</B> then
<I>x</I> specifies the number of pixels
between the right edge of the screen and the right edge of <I>window</I>'s
border. If <I>y</I> is preceded by <B>+</B> then it specifies the
number of pixels between the top of the screen and the top
of <I>window</I>'s border; if <I>y</I> is preceded by <B>:</B> then
it specifies the number of pixels between the bottom of <I>window</I>'s
border and the bottom of the screen.
If <I>newGeometry</I> is specified as an empty string then any
existing user-specified geometry for <I>window</I> is cancelled, and
the window will revert to the size requested internally by its
widgets.
<P>
<DT><A NAME="M18">(<B>wm 'grid </B><I>window</I>)</A><DD>
<DT><A NAME="M19">(<B>wm 'grid </B><I>window</I> <I>baseWidth baseHeight widthInc heightInc</I>)</A><DD>
This procedure indicates that <I>window</I> is to be managed as a
gridded window.
It also specifies the relationship between grid units and pixel units.
<I>BaseWidth</I> and <I>baseHeight</I> specify the number of grid
units corresponding to the pixel dimensions requested internally
by <I>window</I> using <B>Tk_GeometryRequest</B>. <I>WidthInc</I>
and <I>heightInc</I> specify the number of pixels in each horizontal
and vertical grid unit.
These four values determine a range of acceptable sizes for
<I>window</I>, corresponding to grid-based widths and heights
that are non-negative integers.
Tk will pass this information to the window manager; during
manual resizing, the window manager will restrict the window's size
to one of these acceptable sizes.
Furthermore, during manual resizing the window manager will display
the window's current size in terms of grid units rather than pixels.
If <I>baseWidth</I> etc. are all specified as empty strings, then
<I>window</I> will no longer be managed as a gridded window. If
<I>baseWidth</I> etc. are specified then the return value is an
empty list.
Otherwise the return value is a STk list containing
four elements corresponding to the current <I>baseWidth</I>,
<I>baseHeight</I>, <I>widthInc</I>, and <I>heightInc</I>; if
<I>window</I> is not currently gridded, then <B>#f</B>
is returned.
Note: this procedure should not be needed very often, since the
<B>Tk_SetGrid</B> library procedure and the <B>setGrid</B> option
provide easier access to the same functionality.
<P>
<DT><A NAME="M20">(<B>wm 'group </B><I>window</I>)</A><DD>
<DT><A NAME="M21">(<B>wm 'group </B><I>window</I> <I>widget-name</I>)</A><DD>
If <I>widget-name</I> is specified, it gives the path name for the leader of
a group of related windows. The window manager may use this information,
for example, to unmap all of the windows in a group when the group's
leader is iconified. <I>PathName</I> may be specified as <B>#f</B> to
remove <I>window</I> from any group association. If <I>widget-name</I> is
specified then the procedure returns an empty list; otherwise it
returns the path name of <I>window</I>'s current group leader, or <B>#f</B>
if <I>window</I> isn't part of any group.
<P>
<DT><A NAME="M22">(<B>wm 'iconbitmap </B><I>window</I>)</A><DD>
<DT><A NAME="M23">(<B>wm 'iconbitmap </B><I>window</I> <I>bitmap</I>)</A><DD>
If <I>bitmap</I> is specified, then it names a bitmap in the standard
forms accepted by Tk (see the <B>Tk_GetBitmap</B> manual entry for details).
This bitmap is passed to the window manager to be displayed in
<I>window</I>'s icon, and the procedure returns an empty list. If
<B>#f</B> is specified for <I>bitmap</I>, then any current icon
bitmap is cancelled for <I>window</I>.
If <I>bitmap</I> is specified then the procedure returns an empty list.
Otherwise it returns the name of
the current icon bitmap associated with <I>window</I>, or <B>#f</B>
string if <I>window</I> has no icon bitmap.
<P>
<DT><A NAME="M24">(<B>wm 'iconify </B><I>window</I>)</A><DD>
Arrange for <I>window</I> to be iconified. It <I>window</I> hasn't
yet been mapped for the first time, this procedure will arrange for
it to appear in the iconified state when it is eventually mapped.
<P>
<DT><A NAME="M25">(<B>wm 'iconmask </B><I>window</I>)</A><DD>
<DT><A NAME="M26">(<B>wm 'iconmask </B><I>window</I> <I>bitmap</I>)</A><DD>
If <I>bitmap</I> is specified, then it names a bitmap in the standard
forms accepted by Tk (see the <B>Tk_GetBitmap</B> manual entry for details).
This bitmap is passed to the window manager to be used as a mask
in conjunction with the <B>iconbitmap</B> option: where the mask
has zeroes no icon will be displayed; where it has ones, the bits
from the icon bitmap will be displayed. If
<B>#f</B> is specified for <I>bitmap</I> then any current icon
mask is cancelled for <I>window</I> (this is equivalent to specifying
a bitmap of all ones). If <I>bitmap</I> is specified
then the procedure returns an empty string. Otherwise it
returns the name of the current icon mask associated with
<I>window</I>, or <B>#f</B> if no mask is in effect.
<P>
<DT><A NAME="M27">(<B>wm 'iconname </B><I>window</I>)</A><DD>
<DT><A NAME="M28">(<B>wm 'iconname </B><I>window</I> <I>newName</I>)</A><DD>
If <I>newName</I> is specified, then it is passed to the window
manager; the window manager should display <I>newName</I> inside
the icon associated with <I>window</I>. In this case an empty
list is returned as result. If <I>newName</I> isn't specified
then the procedure returns the current icon name for <I>window</I>,
or an empty string if no icon name has been specified (in this
case the window manager will normally display the window's title,
as specified with the <B>wm title</B> procedure).
<P>
<DT><A NAME="M29">(<B>wm 'iconposition </B><I>window</I>)</A><DD>
<DT><A NAME="M30">(<B>wm 'iconposition </B><I>window</I> <I>x y</I>)</A><DD>
If <I>x</I> and <I>y</I> are specified, they are passed to the window
manager as a hint about where to position the icon for <I>window</I>.
In this case an empty list is returned. If <I>x</I> and <I>y</I> are
specified as <B>#f</B> then any existing icon position hint is cancelled.
If neither <I>x</I> nor <I>y</I> is specified, then the procedure returns
a list containing two values, which are the current icon position
hints (if no hints are in effect then <B>#f</B> list is returned).
<P>
<DT><A NAME="M31">(<B>wm 'iconwindow </B><I>window</I>)</A><DD>
<DT><A NAME="M32">(<B>wm 'iconwindow </B><I>window</I> <I>widget-name</I>)</A><DD>
If <I>widget-name</I> is specified, it is the path name for a window to
use as icon for <I>window</I>: when <I>window</I> is iconified then
<I>widget-name</I> will be mapped to serve as icon, and when <I>window</I>
is de-iconified then <I>widget-name</I> will be unmapped again. If
<I>widget-name</I> is specified as <B>#f</B> then any existing
icon window association for <I>window</I> will be cancelled. If
the <I>widget-name</I> argument is specified then an empty list is
returned. Otherwise the procedure returns the path name of the
current icon window for <I>window</I>, or <B>#f</B> if there
is no icon window currently specified for <I>window</I>.
Button press events are disabled for <I>window</I> as long as it is
an icon window; this is needed in order to allow window managers
to ``own'' those events.
Note: not all window managers support the notion of an icon window.
<P>
<DT><A NAME="M33">(<B>wm 'maxsize </B><I>window</I>)</A><DD>
<DT><A NAME="M34">(<B>wm 'maxsize </B><I>window</I> <I>width height</I>)</A><DD>
If <I>width</I> and <I>height</I> are specified, they give
the maximum permissible dimensions for <I>window</I>.
For gridded windows the dimensions are specified in
grid units; otherwise they are specified in pixel units.
The window manager will restrict the window's dimensions to be
less than or equal to <I>width</I> and <I>height</I>.
If <I>width</I> and <I>height</I> are
specified, then the procedure returns an empty string. Otherwise
it returns a list with two elements, which are the
maximum width and height currently in effect.
The maximum size defaults to the size of the screen.
If resizing has been disabled with the <B>wm resizable</B> procedure,
then this procedure has no effect.
See the sections on geometry management below for more information.
<P>
<DT><A NAME="M35">(<B>wm 'minsize </B><I>window</I>)</A><DD>
<DT><A NAME="M36">(<B>wm 'minsize </B><I>window</I> <I>width height</I>)</A><DD>
If <I>width</I> and <I>height</I> are specified, they give the
minimum permissible dimensions for <I>window</I>.
For gridded windows the dimensions are specified in
grid units; otherwise they are specified in pixel units.
The window manager will restrict the window's dimensions to be
greater than or equal to <I>width</I> and <I>height</I>.
If <I>width</I> and <I>height</I> are
specified, then the procedure returns an empty string. Otherwise
it returns a list with two elements, which are the
minimum width and height currently in effect.
The minimum size defaults to one pixel in each dimension.
If resizing has been disabled with the <B>wm resizable</B> procedure,
then this procedure has no effect.
See the sections on geometry management below for more information.
<P>
<DT><A NAME="M37">(<B>wm 'overrideredirect </B><I>window</I>)</A><DD>
<DT><A NAME="M38">(<B>wm 'overrideredirect </B><I>window</I> <I>boolean</I>)</A><DD>
If <I>boolean</I> is specified, it must have a proper boolean form and
the override-redirect flag for <I>window</I> is set to that value.
If <I>boolean</I> is not specified then <B>#t</B> or <B>#f</B> is
returned to indicate whether or not the override-redirect flag
is currently set for <I>window</I>.
Setting the override-redirect flag for a window causes
it to be ignored by the window manager; among other things, this means
that the window will not be reparented from the root window into a
decorative frame and the user will not be able to manipulate the
window using the normal window manager mechanisms.
<P>
<DT><A NAME="M39">(<B>wm 'positionfrom </B><I>window</I>)</A><DD>
<DT><A NAME="M40">(<B>wm 'positionfrom </B><I>window</I> <I>who</I>)</A><DD>
If <I>who</I> is specified, it must be <B>program</B>,
<B>user</B> (or an abbreviation of one of these two), or <B>#f</B>.
It indicates
whether <I>window</I>'s current position was requested by the
program or by the user. Many window managers ignore program-requested
initial positions and ask the user to manually position the window; if
<B>user</B> is specified then the window manager should position the
window at the given place without asking the user for assistance.
If <I>who</I> is specified as <B>#f</B>, then the current position
source is cancelled.
If <I>who</I> is specified, then the procedure returns an empty list.
Otherwise it returns <B>user</B> or <B>window</B> to indicate the
source of the window's current position, or <B>#F</B> if
no source has been specified yet. Most window managers interpret
``no source'' as equivalent to <B>program</B>.
Tk will automatically set the position source to <B>user</B>
when a <B>wm geometry</B> procedure is invoked, unless the source has
been set explicitly to <B>program</B>.
<P>
<DT><A NAME="M41">(<B>wm 'protocol </B><I>window</I> ?<I>name</I>? ?<I>procedure</I>?)</A><DD>
This procedure is used to manage window manager protocols such as
<B>WM_DELETE_WINDOW</B>.
<I>Name</I> is the name of an atom corresponding to a window manager
protocol, such as <B>WM_DELETE_WINDOW</B> or <B>WM_SAVE_YOURSELF</B>
or <B>WM_TAKE_FOCUS</B>.
If both <I>name</I> and <I>procedure</I> are specified, then <I>procedure</I>
is associated with the protocol specified by <I>name</I>.
<I>Name</I> will be added to <I>window</I>'s <B>WM_PROTOCOLS</B>
property to tell the window manager that the application has a
protocol handler for <I>name</I>, and <I>procedure</I> will
be invoked in the future whenever the window manager sends a
message to the client for that protocol.
In this case the procedure returns an empty list.
If <I>name</I> is specified but <I>procedure</I> isn't, then the current
procedure for <I>name</I> is returned, or an empty list if there
is no handler defined for <I>name</I>.
If <I>procedure</I> is specified as an empty string then the current
handler for <I>name</I> is deleted and it is removed from the
<B>WM_PROTOCOLS</B> property on <I>window</I>; an empty string is
returned.
Lastly, if neither <I>name</I> nor <I>procedure</I> is specified, the
procedure returns a list of all the protocols for which handlers
are currently defined for <I>window</I>.
<P>
<UL>
<P>
Tk always defines a protocol handler for <B>WM_DELETE_WINDOW</B>, even if
you haven't asked for one with <B>wm protocol</B>.
If a <B>WM_DELETE_WINDOW</B> message arrives when you haven't defined
a handler, then Tk handles the message by destroying the window for
which it was received.
</UL>
<DT><A NAME="M42">(<B>wm 'resizable </B><I>window</I>)</A><DD>
<DT><A NAME="M43">(<B>wm 'resizable </B><I>window</I> <I>width height</I>)</A><DD>
This procedure controls whether or not the user may interactively
resize a top-level window. If <I>width</I> and <I>height</I> are
specified, they are boolean values that determine whether the
width and height of <I>window</I> may be modified by the user.
In this case the procedure returns an empty string.
If <I>width</I> and <I>height</I> are omitted then the procedure
returns a list with two boolean elements that indicate whether the
width and height of <I>window</I> are currently resizable.
By default, windows are resizable in both dimensions.
If resizing is disabled, then the window's size will be the size
from the most recent interactive resize or <B>wm geometry</B>
procedure. If there has been no such operation then
the window's natural size will be used.
<P>
<DT><A NAME="M44">(<B>wm 'sizefrom </B><I>window</I>)</A><DD>
<DT><A NAME="M45">(<B>wm 'sizefrom </B><I>window</I> <I>who</I>)</A><DD>
If <I>who</I> is specified, it must be <B>program</B>
<B>user</B> (or an abbreviation of one of these two) or <B>#f</B> . It indicates
whether <I>window</I>'s current size was requested by the
program or by the user. Some window managers ignore program-requested
sizes and ask the user to manually size the window; if
<B>user</B> is specified then the window manager should give the
window its specified size without asking the user for assistance.
If <I>who</I> is specified as <B>#f</B>, then the current size
source is cancelled.
If <I>who</I> is specified, then the procedure returns an empty string.
Otherwise it returns <B>user</B> or <B>window</B> to indicate the
source of the window's current size, or <B>#f</B> if
no source has been specified yet. Most window managers interpret
``no source'' as equivalent to <B>program</B>.
<P>
<DT><A NAME="M46">(<B>wm 'state </B><I>window</I>)</A><DD>
Returns the current state of <I>window</I>: either &quot;<B>normal</B>&quot;,
&quot;<B>iconic</B>&quot;, &quot;<B>withdrawn</B>&quot;, or &quot;<B>icon</B>&quot;. The difference
between &quot;<B>iconic</B>&quot; and &quot;<B>icon</B>&quot; is that &quot;<B>iconic</B>&quot; refers
to a window that has been iconified (e.g., with the <B>wm iconify</B>
command) while &quot;<B>icon</B>&quot; refers to a window whose only purpose is
to serve as the icon for some other window (via the <B>wm iconwindow</B>
command).
<P>
<DT><A NAME="M47">(<B>wm 'title </B><I>window</I>)</A><DD>
<DT><A NAME="M48">(<B>wm 'title </B><I>window</I> <I>string</I>)</A><DD>
If <I>string</I> is specified, then it will be passed to the window
manager for use as the title for <I>window</I> (the window manager
should display this string in <I>window</I>'s title bar). In this
case the procedure returns an empty list. If <I>string</I> isn't
specified then the procedure returns the current title for the
<I>window</I>. The title for a window defaults to its name.
<P>
<DT><A NAME="M49">(<B>wm 'transient </B><I>window</I>)</A><DD>
<DT><A NAME="M50">(<B>wm 'transient </B><I>window</I> <I>master</I>)</A><DD>
If <I>master</I> is specified, then the window manager is informed
that <I>window</I> is a transient window (e.g. pull-down menu) working
on behalf of <I>master</I> (where <I>master</I> is the
path name for a top-level window). Some window managers will use
this information to manage <I>window</I> specially. If <I>master</I>
is specified as <B>#f</B> then <I>window</I> is marked as not
being a transient window any more. If <I>master</I> is specified,
then the procedure returns an empty list. Otherwise the procedure
returns the path name of <I>window</I>'s current master, or
<B>#f</B> if <I>window</I> isn't currently a transient window.
<P>
<DT><A NAME="M51">(<B>wm 'withdraw </B><I>window</I>)</A><DD>
Arranges for <I>window</I> to be withdrawn from the screen. This
causes the window to be unmapped and forgotten about by the window
manager. If the window
has never been mapped, then this procedure
causes the window to be mapped in the withdrawn state. Not all
window managers appear to know how to handle windows that are
mapped in the withdrawn state.
Note: it sometimes seems to be necessary to withdraw a
window and then re-map it (e.g. with <B>wm deiconify</B>) to get some
window managers to pay attention to changes in window attributes
such as group.
<P>
</DL>
<H3><A NAME="M52">GEOMETRY MANAGEMENT</A></H3>
By default a top-level window appears on the screen in its
<I>natural size</I>, which is the one determined internally by its
widgets and geometry managers.
If the natural size of a top-level window changes, then the window's size
changes to match.
A top-level window can be given a size other than its natural size in two ways.
First, the user can resize the window manually using the facilities
of the window manager, such as resize handles.
Second, the application can request a particular size for a
top-level window using the <B>wm geometry</B> procedure.
These two cases are handled identically by Tk; in either case,
the requested size overrides the natural size.
You can return the window to its natural by invoking <B>wm geometry</B>
with an empty <I>geometry</I> string.
<P>
Normally a top-level window can have any size from one pixel in each
dimension up to the size of its screen.
However, you can use the <B>wm minsize</B> and <B>wm maxsize</B> procedures
to limit the range of allowable sizes.
The range set by <B>wm minsize</B> and <B>wm maxsize</B> applies to
all forms of resizing, including the window's natural size as
well as manual resizes and the <B>wm geometry</B> procedure.
You can also use the procedure <B>wm resizable</B> to completely
disable interactive resizing in one or both dimensions.
<H3><A NAME="M53">GRIDDED GEOMETRY MANAGEMENT</A></H3>
Gridded geometry management occurs when one of the widgets of an
application supports a range of useful sizes.
This occurs, for example, in a text editor where the scrollbars,
menus, and other adornments are fixed in size but the edit widget
can support any number of lines of text or characters per line.
In this case, it is usually desirable to let the user specify the
number of lines or characters-per-line, either with the
<B>wm geometry</B> procedure or by interactively resizing the window.
In the case of text, and in other interesting cases also, only
discrete sizes of the window make sense, such as integral numbers
of lines and characters-per-line; arbitrary pixel sizes are not useful.
<P>
Gridded geometry management provides support for this kind of
application.
Tk (and the window manager) assume that there is a grid of some
sort within the application and that the application should be
resized in terms of <I>grid units</I> rather than pixels.
Gridded geometry management is typically invoked by turning on
the <B>setGrid</B> option for a widget; it can also be invoked
with the <B>wm grid</B> procedure or by calling <B>Tk_SetGrid</B>.
In each of these approaches the particular widget (or sometimes
code in the application as a whole) specifies the relationship between
integral grid sizes for the window and pixel sizes.
To return to non-gridded geometry management, invoke
<B>wm grid</B> with empty argument strings.
<P>
When gridded geometry management is enabled then all the dimensions specified
in <B>wm minsize</B>, <B>wm maxsize</B>, and <B>wm geometry</B> procedures
are treated as grid units rather than pixel units.
Interactive resizing is also carried out in even numbers of grid units
rather than pixels.
<H3><A NAME="M54">BUGS</A></H3>
Most existing window managers appear to have bugs that affect the
operation of the <B>wm</B> procedure. For example, some changes won't
take effect if the window is already active: the window will have
to be withdrawn and de-iconified in order to make the change happen.
<H3><A NAME="M55">SEE ALSO</A></H3>
<B><A HREF="./toplevel.n.html">toplevel</A></B>
<P><IMG ALIGN=TOP SRC="./Img/line-red.gif"><P>
<A HREF=./STk-hlp.html><IMG ALIGN=BOTTOM SRC="./Img/RefBookBlue.gif"> Back to the <B>STk</B> main page</A>
</BODY></HTML>