diff options
author | donal.k.fellows@manchester.ac.uk <dkf> | 2004-06-21 19:56:11 (GMT) |
---|---|---|
committer | donal.k.fellows@manchester.ac.uk <dkf> | 2004-06-21 19:56:11 (GMT) |
commit | 9d53a437fdef2b4da0b4d1a99531258d14a7249c (patch) | |
tree | b693e3d0d2a892caa5ea612bd32c273e92153fd5 /doc/wm.n | |
parent | 9d2f5772cf90c8b51cca7d33f238227464f83a9b (diff) | |
download | tk-9d53a437fdef2b4da0b4d1a99531258d14a7249c.zip tk-9d53a437fdef2b4da0b4d1a99531258d14a7249c.tar.gz tk-9d53a437fdef2b4da0b4d1a99531258d14a7249c.tar.bz2 |
Added example of how to do dialog-like windows
Diffstat (limited to 'doc/wm.n')
-rw-r--r-- | doc/wm.n | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -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) |