Updated 2017-09-21 09:37:33 by MHo

"How can I keep my toplevel on top?" is a FAQ. See http://tcl.sourceforge.net/faqs/tk/#wm/ontop for portable Tk solutions, and raise for related information.

Win32 edit

MPJ - June 21, 2002

Now that topmost is supported in the Tcl core (8.4 and higher) for the MsWindows platform you can just use:
wm attributes (window) -topmost 1

The example below will cause the topmost setting to be toggled when the F3 key is pressed.
bind . <F3> "setontop"
proc setontop {} {wm attributes . -topmost [expr [wm attributes . -topmost] ^ 1]}


UNIX Systems edit

The -topmost attribute is also supported there provided you've got Tk 8.5 (and provided your WM takes notice, which most do).
wm attribute .theWindow -topmost 1