seannakasone@yahoo.com wrote:
> I'm using Windows XP service pack 2
> tcl/tk v8.4
It appears to be a Windows bug. The problem is not the chained grab
(which doesn't work by the way)*. But the problem is the multi-level
transients. The following code illustrates the bug:
# Multi level transient:
toplevel .t
wm transient .t .
toplevel .t.t
wm transient .t.t .t
toplevel .t.t.t
wm transient .t.t.t .t.t
grab .t.t.t
The following code removes the bug:
# Single level transient:
toplevel .t
wm transient .t .
toplevel .t.t
wm transient .t.t .
toplevel .t.t.t
wm transient .t.t.t .
grab .t.t.t
By the way, multiple grab doesn't work on windows without some hard
work on your part. In your original code, try creating all the windows
and then close the last created window. You will find that all grabs
are released. With this in mind, perhaps multi level transient is not
what you want as grabbing already ensures that the other windows cannot
be brought to the top. Here's a modified version of your code
illustrating my suggested work-around and works, I believe, exactly the
way you intended:
proc opendlg3 {} {
toplevel .t.t.t
wm transient .t.t.t . ;# this keeps .t on top of .
wm geometry .t.t.t +10+10
wm withdraw .t.t.t
wm title .t.t.t "my title3"
button .t.t.t.b -text "clickme" \
-width 30 -height 30 -command ""
pack .t.t.t.b
wm deiconify .t.t.t
# This brings us to the top
# The grab prevents others
# from being on top.
raise .t.t.t
grab .t.t.t
update
# This next bit makes sure grab
# chaining works.
wm protocol .t.t.t WM_DELETE_WINDOW {
destroy .t.t.t
grab .t.t
}
}
proc opendlg2 {} {
toplevel .t.t
wm transient .t.t . ;# this keeps .t on top of .
wm geometry .t.t +10+10
wm withdraw .t.t
wm title .t.t "my title2"
button .t.t.b -text "clickme" \
-width 30 -height 30 -command "opendlg3"
pack .t.t.b
wm deiconify .t.t
# This brings us to the top
# The grab prevents others
# from being on top.
raise .t.t
grab .t.t
update
# This next bit makes sure grab
# chaining works.
wm protocol .t.t WM_DELETE_WINDOW {
destroy .t.t
grab .t
}
}
proc opendlg {} {
toplevel .t
wm transient .t . ;# this keeps .t on top of .
wm geometry .t +10+10
wm withdraw .t
wm title .t "my title"
button .t.b -text "clickme" \
-width 30 -height 30 -command "opendlg2"
pack .t.b
wm deiconify .t
grab .t
update
}
button .b -text "click me" \
-width 30 -height 30 -command "opendlg"
pack .b
Received on Sun Apr 30 02:45:06 2006