520 lines
32 KiB
HTML
520 lines
32 KiB
HTML
<HTML><HEAD><TITLE>Tk Built-In Commands - wm manual page</TITLE></HEAD><BODY>
|
|
<DL>
|
|
<DD><A HREF="wm.htm#M2" NAME="L1283">NAME</A>
|
|
<DL><DD>wm - Communicate with window manager</DL>
|
|
<DD><A HREF="wm.htm#M3" NAME="L1284">SYNOPSIS</A>
|
|
<DL>
|
|
<DD><B>wm</B> <I>option window </I>?<I>args</I>?
|
|
</DL>
|
|
<DD><A HREF="wm.htm#M4" NAME="L1285">DESCRIPTION</A>
|
|
<DL>
|
|
<DD><A HREF="wm.htm#M5" NAME="L1286"><B>wm aspect </B><I>window</I> ?<I>minNumer minDenom maxNumer maxDenom</I>?</A>
|
|
<DD><A HREF="wm.htm#M6" NAME="L1287"><B>wm client </B><I>window</I> ?<I>name</I>?</A>
|
|
<DD><A HREF="wm.htm#M7" NAME="L1288"><B>wm colormapwindows </B><I>window</I> ?<I>windowList</I>?</A>
|
|
<DD><A HREF="wm.htm#M8" NAME="L1289"><B>wm command </B><I>window</I> ?<I>value</I>?</A>
|
|
<DD><A HREF="wm.htm#M9" NAME="L1290"><B>wm deiconify </B><I>window</I></A>
|
|
<DD><A HREF="wm.htm#M10" NAME="L1291"><B>wm focusmodel </B><I>window</I> ?<B>active</B>|<B>passive</B>?</A>
|
|
<DD><A HREF="wm.htm#M11" NAME="L1292"><B>wm frame </B><I>window</I></A>
|
|
<DD><A HREF="wm.htm#M12" NAME="L1293"><B>wm geometry </B><I>window</I> ?<I>newGeometry</I>?</A>
|
|
<DD><A HREF="wm.htm#M13" NAME="L1294"><B>wm grid </B><I>window</I> ?<I>baseWidth baseHeight widthInc heightInc</I>?</A>
|
|
<DD><A HREF="wm.htm#M14" NAME="L1295"><B>wm group </B><I>window</I> ?<I>pathName</I>?</A>
|
|
<DD><A HREF="wm.htm#M15" NAME="L1296"><B>wm iconbitmap </B><I>window</I> ?<I>bitmap</I>?</A>
|
|
<DD><A HREF="wm.htm#M16" NAME="L1297"><B>wm iconify </B><I>window</I></A>
|
|
<DD><A HREF="wm.htm#M17" NAME="L1298"><B>wm iconmask </B><I>window</I> ?<I>bitmap</I>?</A>
|
|
<DD><A HREF="wm.htm#M18" NAME="L1299"><B>wm iconname </B><I>window</I> ?<I>newName</I>?</A>
|
|
<DD><A HREF="wm.htm#M19" NAME="L1300"><B>wm iconposition </B><I>window</I> ?<I>x y</I>?</A>
|
|
<DD><A HREF="wm.htm#M20" NAME="L1301"><B>wm iconwindow </B><I>window</I> ?<I>pathName</I>?</A>
|
|
<DD><A HREF="wm.htm#M21" NAME="L1302"><B>wm maxsize </B><I>window</I> ?<I>width height</I>?</A>
|
|
<DD><A HREF="wm.htm#M22" NAME="L1303"><B>wm minsize </B><I>window</I> ?<I>width height</I>?</A>
|
|
<DD><A HREF="wm.htm#M23" NAME="L1304"><B>wm overrideredirect </B><I>window</I> ?<I>boolean</I>?</A>
|
|
<DD><A HREF="wm.htm#M24" NAME="L1305"><B>wm positionfrom </B><I>window</I> ?<I>who</I>?</A>
|
|
<DD><A HREF="wm.htm#M25" NAME="L1306"><B>wm protocol </B><I>window</I> ?<I>name</I>? ?<I>command</I>?</A>
|
|
<DD><A HREF="wm.htm#M26" NAME="L1307"><B>wm resizable </B><I>window</I> ?<I>width height</I>?</A>
|
|
<DD><A HREF="wm.htm#M27" NAME="L1308"><B>wm sizefrom </B><I>window</I> ?<I>who</I>?</A>
|
|
<DD><A HREF="wm.htm#M28" NAME="L1309"><B>wm state </B><I>window</I> ?newstate?</A>
|
|
<DD><A HREF="wm.htm#M29" NAME="L1310"><B>wm title </B><I>window</I> ?<I>string</I>?</A>
|
|
<DD><A HREF="wm.htm#M30" NAME="L1311"><B>wm transient </B><I>window</I> ?<I>master</I>?</A>
|
|
<DD><A HREF="wm.htm#M31" NAME="L1312"><B>wm withdraw </B><I>window</I></A>
|
|
</DL>
|
|
<DD><A HREF="wm.htm#M32" NAME="L1313">GEOMETRY MANAGEMENT</A>
|
|
<DD><A HREF="wm.htm#M33" NAME="L1314">GRIDDED GEOMETRY MANAGEMENT</A>
|
|
<DD><A HREF="wm.htm#M34" NAME="L1315">BUGS</A>
|
|
<DD><A HREF="wm.htm#M35" NAME="L1316">KEYWORDS</A>
|
|
</DL><HR>
|
|
<H3><A NAME="M2">NAME</A></H3>
|
|
wm - Communicate with window manager
|
|
<H3><A NAME="M3">SYNOPSIS</A></H3>
|
|
<B>wm</B> <I>option window </I>?<I>args</I>?<BR>
|
|
<H3><A NAME="M4">DESCRIPTION</A></H3>
|
|
The <B>wm</B> command 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>
|
|
command 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> command are:
|
|
<P>
|
|
<DL>
|
|
<P><DT><A NAME="M5"><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 command returns an
|
|
empty string. Otherwise, it returns
|
|
a Tcl 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 string is
|
|
returned).
|
|
<P><DT><A NAME="M6"><B>wm client </B><I>window</I> ?<I>name</I>?</A><DD>
|
|
If <I>name</I> is specified, this command 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 command returns an empty string in this case.
|
|
If <I>name</I> isn't specified, the command returns the last name
|
|
set in a <B>wm client</B> command for <I>window</I>.
|
|
If <I>name</I> is specified as an empty string, the command deletes the
|
|
<B>WM_CLIENT_MACHINE</B> property from <I>window</I>.
|
|
<P><DT><A NAME="M7"><B>wm colormapwindows </B><I>window</I> ?<I>windowList</I>?</A><DD>
|
|
This command 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 command 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 command overwrites the <B>WM_COLORMAP_WINDOWS</B>
|
|
property with the given windows and returns an empty string.
|
|
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="M8"><B>wm command </B><I>window</I> ?<I>value</I>?</A><DD>
|
|
If <I>value</I> is specified, this command 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 string.
|
|
<I>Value</I> must have proper list structure; the elements should
|
|
contain the words of the command used to invoke the application.
|
|
If <I>value</I> isn't specified then the command returns the last value
|
|
set in a <B>wm command</B> command for <I>window</I>.
|
|
If <I>value</I> is specified as an empty string, the command
|
|
deletes the <B>WM_COMMAND</B> property from <I>window</I>.
|
|
<P><DT><A NAME="M9"><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 command will not map the window, but it will ensure
|
|
that when the window is first mapped it will be displayed
|
|
in de-iconified form. On Windows, a deiconified window will also be
|
|
raised and be given the focus (made the active window).
|
|
Returns an empty string.
|
|
<P><DT><A NAME="M10"><B>wm focusmodel </B><I>window</I> ?<B>active</B>|<B>passive</B>?</A><DD>
|
|
If <B>active</B> or <B>passive</B> is supplied as an optional argument
|
|
to the command, then it specifies the focus model for <I>window</I>.
|
|
In this case the command returns an empty string. If no additional
|
|
argument is supplied, then the command 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="../TclCmd/focus.htm">focus</A></B> command
|
|
assumes a passive model of focusing.
|
|
<P><DT><A NAME="M11"><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 command returns the platform specific 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 command returns
|
|
the platform specific window identifier for <I>window</I>.
|
|
<P><DT><A NAME="M12"><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 string 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> command). <I>NewGeometry</I> has
|
|
the form <B>=</B><I>width</I><B>x</B><I>height</I><B>±</B><I>x</I><B>±</B><I>y</I>, where
|
|
any of <B>=</B>, <I>width</I><B>x</B><I>height</I>, or <B>±</B><I>x</I><B>±</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="M13"><B>wm grid </B><I>window</I> ?<I>baseWidth baseHeight widthInc heightInc</I>?</A><DD>
|
|
This command 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><A HREF="../TclLib/GeomReq.htm">Tk_GeometryRequest</A></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 string.
|
|
Otherwise the return value is a Tcl 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 an empty string
|
|
is returned.
|
|
Note: this command should not be needed very often, since the
|
|
<B><A HREF="../TclLib/SetGrid.htm">Tk_SetGrid</A></B> library procedure and the <B>setGrid</B> option
|
|
provide easier access to the same functionality.
|
|
<P><DT><A NAME="M14"><B>wm group </B><I>window</I> ?<I>pathName</I>?</A><DD>
|
|
If <I>pathName</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 an empty string to
|
|
remove <I>window</I> from any group association. If <I>pathName</I> is
|
|
specified then the command returns an empty string; otherwise it
|
|
returns the path name of <I>window</I>'s current group leader, or an empty
|
|
string if <I>window</I> isn't part of any group.
|
|
<P><DT><A NAME="M15"><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><A HREF="../TclLib/GetBitmap.htm">Tk_GetBitmap</A></B> manual entry for details).
|
|
This bitmap is passed to the window manager to be displayed in
|
|
<I>window</I>'s icon, and the command returns an empty string. If
|
|
an empty string 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 command returns an empty string.
|
|
Otherwise it returns the name of
|
|
the current icon bitmap associated with <I>window</I>, or an empty
|
|
string if <I>window</I> has no icon bitmap. On the Windows operating
|
|
system, an additional flag is supported:
|
|
<B>wm iconbitmap </B><I>window</I> ?<I>-default</I>? ?<I>image</I>?.
|
|
If the <I>-default</I>
|
|
flag is given, the icon is applied to all toplevel windows (existing
|
|
and future) to which no other specific icon has yet been applied.
|
|
In addition to bitmap image types, any file which contains a valid
|
|
Windows icon is also accepted (usually .ico or .icr files). Tcl will
|
|
first test if the files contains an icon, and if that fails, test for
|
|
a bitmap.
|
|
<P><DT><A NAME="M16"><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 command will arrange for
|
|
it to appear in the iconified state when it is eventually mapped.
|
|
<P><DT><A NAME="M17"><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><A HREF="../TclLib/GetBitmap.htm">Tk_GetBitmap</A></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
|
|
an empty string 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 command returns an empty string. Otherwise it
|
|
returns the name of the current icon mask associated with
|
|
<I>window</I>, or an empty string if no mask is in effect.
|
|
<P><DT><A NAME="M18"><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
|
|
string is returned as result. If <I>newName</I> isn't specified
|
|
then the command 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> command).
|
|
<P><DT><A NAME="M19"><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 string is returned. If <I>x</I> and <I>y</I> are
|
|
specified as empty strings then any existing icon position hint is cancelled.
|
|
If neither <I>x</I> nor <I>y</I> is specified, then the command returns
|
|
a Tcl list containing two values, which are the current icon position
|
|
hints (if no hints are in effect then an empty string is returned).
|
|
<P><DT><A NAME="M20"><B>wm iconwindow </B><I>window</I> ?<I>pathName</I>?</A><DD>
|
|
If <I>pathName</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>pathName</I> will be mapped to serve as icon, and when <I>window</I>
|
|
is de-iconified then <I>pathName</I> will be unmapped again. If
|
|
<I>pathName</I> is specified as an empty string then any existing
|
|
icon window association for <I>window</I> will be cancelled. If
|
|
the <I>pathName</I> argument is specified then an empty string is
|
|
returned. Otherwise the command returns the path name of the
|
|
current icon window for <I>window</I>, or an empty string 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="M21"><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 command returns an empty string. Otherwise
|
|
it returns a Tcl 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> command,
|
|
then this command has no effect.
|
|
See the sections on geometry management below for more information.
|
|
<P><DT><A NAME="M22"><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 command returns an empty string. Otherwise
|
|
it returns a Tcl 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> command,
|
|
then this command has no effect.
|
|
See the sections on geometry management below for more information.
|
|
<P><DT><A NAME="M23"><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>1</B> or <B>0</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="M24"><B>wm positionfrom </B><I>window</I> ?<I>who</I>?</A><DD>
|
|
If <I>who</I> is specified, it must be either <B>program</B> or
|
|
<B>user</B>, or an abbreviation of one of these two. 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 an empty string, then the current position
|
|
source is cancelled.
|
|
If <I>who</I> is specified, then the command returns an empty string.
|
|
Otherwise it returns <B>user</B> or <B>program</B> to indicate the
|
|
source of the window's current position, or an empty string 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> command is invoked, unless the source has
|
|
been set explicitly to <B>program</B>.
|
|
<P><DT><A NAME="M25"><B>wm protocol </B><I>window</I> ?<I>name</I>? ?<I>command</I>?</A><DD>
|
|
This command 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>command</I> are specified, then <I>command</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>command</I> will
|
|
be invoked in the future whenever the window manager sends a
|
|
message to the client for that protocol.
|
|
In this case the command returns an empty string.
|
|
If <I>name</I> is specified but <I>command</I> isn't, then the current
|
|
command for <I>name</I> is returned, or an empty string if there
|
|
is no handler defined for <I>name</I>.
|
|
If <I>command</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>command</I> is specified, the
|
|
command returns a list of all the protocols for which handlers
|
|
are currently defined for <I>window</I>.
|
|
<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.
|
|
<P><DT><A NAME="M26"><B>wm resizable </B><I>window</I> ?<I>width height</I>?</A><DD>
|
|
This command 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 command returns an empty string.
|
|
If <I>width</I> and <I>height</I> are omitted then the command
|
|
returns a list with two 0/1 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>
|
|
command. If there has been no such operation then
|
|
the window's natural size will be used.
|
|
<P><DT><A NAME="M27"><B>wm sizefrom </B><I>window</I> ?<I>who</I>?</A><DD>
|
|
If <I>who</I> is specified, it must be either <B>program</B> or
|
|
<B>user</B>, or an abbreviation of one of these two. 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 an empty string, then the current size
|
|
source is cancelled.
|
|
If <I>who</I> is specified, then the command 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 an empty string if
|
|
no source has been specified yet. Most window managers interpret
|
|
``no source'' as equivalent to <B>program</B>.
|
|
<P><DT><A NAME="M28"><B>wm state </B><I>window</I> ?newstate?</A><DD>
|
|
If <I>newstate</I> is specified, the window will be set to the new state,
|
|
otherwise it returns the current state of <I>window</I>: either
|
|
<B>normal</B>, <B>iconic</B>, <B>withdrawn</B>, <B>icon</B>, or (Windows only)
|
|
<B>zoomed</B>. The difference between <B>iconic</B> and <B>icon</B> is that
|
|
<B>iconic</B> refers to a window that has been iconified (e.g., with the
|
|
<B>wm iconify</B> command) while <B>icon</B> refers to a window whose only
|
|
purpose is to serve as the icon for some other window (via the <B>wm
|
|
iconwindow</B> command). The <B>icon</B> state cannot be set.
|
|
<P><DT><A NAME="M29"><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 command returns an empty string. If <I>string</I> isn't
|
|
specified then the command returns the current title for the
|
|
<I>window</I>. The title for a window defaults to its name.
|
|
<P><DT><A NAME="M30"><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 an empty string then <I>window</I> is marked as not
|
|
being a transient window any more. If <I>master</I> is specified,
|
|
then the command returns an empty string. Otherwise the command
|
|
returns the path name of <I>window</I>'s current master, or an
|
|
empty string if <I>window</I> isn't currently a transient window.
|
|
<P><DT><A NAME="M31"><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 command
|
|
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="M32">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> command.
|
|
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> commands
|
|
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> command.
|
|
You can also use the command <B>wm resizable</B> to completely
|
|
disable interactive resizing in one or both dimensions.
|
|
|
|
<H3><A NAME="M33">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> command 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> command or by calling <B><A HREF="../TclLib/SetGrid.htm">Tk_SetGrid</A></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> commands
|
|
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="M34">BUGS</A></H3>
|
|
Most existing window managers appear to have bugs that affect the
|
|
operation of the <B>wm</B> command. 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.
|
|
<P>
|
|
On the Windows operating system <I>wm iconbitmap</I> has no effect when
|
|
passed a bitmap: only icon files currently work properly.
|
|
|
|
<H3><A NAME="M35">KEYWORDS</A></H3>
|
|
<A href="../Keywords/A.htm#aspect ratio">aspect ratio</A>, <A href="../Keywords/D.htm#deiconify">deiconify</A>, <A href="../Keywords/F.htm#focus model">focus model</A>, <A href="../Keywords/G.htm#geometry">geometry</A>, <A href="../Keywords/G.htm#grid">grid</A>, <A href="../Keywords/G.htm#group">group</A>, <A href="../Keywords/I.htm#icon">icon</A>, <A href="../Keywords/I.htm#iconify">iconify</A>, <A href="../Keywords/I.htm#increments">increments</A>, <A href="../Keywords/P.htm#position">position</A>, <A href="../Keywords/S.htm#size">size</A>, <A href="../Keywords/T.htm#title">title</A>, <A href="../Keywords/T.htm#top-level window">top-level window</A>, <A href="../Keywords/U.htm#units">units</A>, <A href="../Keywords/W.htm#window manager">window manager</A>
|
|
<HR><PRE>
|
|
<A HREF="../copyright.htm">Copyright</A> © 1991-1994 The Regents of the University of California.
|
|
<A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc.
|
|
<A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE>
|
|
</BODY></HTML>
|