summaryrefslogtreecommitdiffstats
path: root/doc/wm.n
diff options
context:
space:
mode:
Diffstat (limited to 'doc/wm.n')
-rw-r--r--doc/wm.n28
1 files changed, 26 insertions, 2 deletions
diff --git a/doc/wm.n b/doc/wm.n
index c1d3f44..9483994 100644
--- a/doc/wm.n
+++ b/doc/wm.n
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: wm.n,v 1.13 2004/06/18 22:07:59 dkf Exp $
+'\" RCS: @(#) $Id: wm.n,v 1.14 2004/06/21 19:56:11 dkf Exp $
'\"
.so man.macros
.TH wm n 8.4 Tk "Tk Built-In Commands"
@@ -544,13 +544,37 @@ Most existing window managers appear to have bugs that affect the
operation of the \fBwm\fR 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.
-.SH EXAMPLE
+.SH EXAMPLES
A fixed-size window that says that it is fixed-size too:
.CS
toplevel .fixed
\fBwm\fR title .fixed "Fixed-size Window"
\fBwm\fR resizable .fixed 0 0
.CE
+.PP
+A simple dialog-like window, centred on the screen:
+.CS
+# Create and arrange the dialog contents.
+toplevel .msg
+label .msg.l \-text "This is a very simple dialog demo."
+button .msg.ok \-text OK \-default active \-command {destroy .msg}
+pack .msg.ok \-side bottom \-fill x
+pack .msg.l \-expand 1 \-fill both
+
+# Now set the widget up as a centred dialog.
+
+# But first, we need the geometry managers to finish setting
+# up the interior of the dialog, for which we need to run the
+# event loop with the widget hidden completely...
+\fBwm\fR withdraw .msg
+update
+set x [expr {([winfo screenwidth .]\-[winfo width .msg])/2}]
+set y [expr {([winfo screenheight .]\-[winfo height .msg])/2}]
+\fBwm\fR geometry .msg +$x+$y
+\fBwm\fR transient .msg .
+\fBwm\fR title .msg "Dialog demo"
+\fBwm\fR deiconify .msg
+.CE
.SH "SEE ALSO"
toplevel(n), winfo(n)