diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-06-21 19:56:11 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-06-21 19:56:11 (GMT) |
commit | d9c9b4a4c284a3d046d87928a1b6e1496ed7301b (patch) | |
tree | b693e3d0d2a892caa5ea612bd32c273e92153fd5 /doc | |
parent | 93ea954ca77df411bafc64e78c3bc82fb567fc87 (diff) | |
download | tk-d9c9b4a4c284a3d046d87928a1b6e1496ed7301b.zip tk-d9c9b4a4c284a3d046d87928a1b6e1496ed7301b.tar.gz tk-d9c9b4a4c284a3d046d87928a1b6e1496ed7301b.tar.bz2 |
Added example of how to do dialog-like windows
Diffstat (limited to 'doc')
-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) |