Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How tk_messageBox can be made "topmost"?

47 views
Skip to first unread message

ZB

unread,
Aug 25, 2009, 7:47:02 PM8/25/09
to
tk_messageBox is very convenient for error messages - unfortunately, one
cannot predict (or not always), what will be on the screen if an error
occurs, so there's no possibility to use "-parent $path" option. And this
leads to situation, when error message can be hidden under earlier created
other window (any toplevel treated with "wm attributes $path -topmost 1").

Does there exist any way to make sure, that chosen tk_messageBox always will
be "topmost", whatever was on the screen before?

Maybe "-topmost" option could be added to tk_messageBox' options set in the
future?
--
Zbigniew

Robert Heller

unread,
Aug 25, 2009, 8:28:41 PM8/25/09
to

'-topmost' is MS-Windows specific.

Check out 'wm stackorder' and use the results to set the -parent option
to tk_messageBox.

Also check out the focus command. Along with winfo toplevel, this
*should* give you the toplevel window with the current focus.


--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
hel...@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/

ZB

unread,
Aug 26, 2009, 11:05:12 AM8/26/09
to
Dnia 26.08.2009 Robert Heller <hel...@deepsoft.com> napisaďż˝/a:

> Check out 'wm stackorder' and use the results to set the -parent option
> to tk_messageBox.
>
> Also check out the focus command. Along with winfo toplevel, this
> *should* give you the toplevel window with the current focus.

Something like this?

#v+
proc currentTopmostWindow { {path "."} } {
if { [focus] ne "" } { set ctmw [winfo toplevel [focus]]
} else { set ctmw [lindex [wm stackorder .] end]
}
if { $ctmw eq "" } { set ctmw "." }
return $ctmw
}
#v-

--
Zbigniew

0 new messages