| Description: |
OriginalBugID: 2589 RFE
Version: 8.2
SubmitDate: '1999-08-20'
LastModified: '2000-01-29'
Severity: SER
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 602
OS: Other
Machine: NA
ClosedDate: '2000-01-29'
Name:
Christian Werner
Comments:
I think this is a long standing bug which appeared in Tcl/Tk 8.0 when
native look-and-feel was invented.
The problem would disappear if the call of
Tcl_SetServiceMode(TCL_SERVICE_ALL) would be removed before
the Win32 API function MessageBox() is called (but then no redraws of
other windows take place while the dialog
box is open).
An (IMHO unacceptable) workaround on Win32 is not to have more than one
toplevel per application.
ReproducibleScript:
proc mktop w {
if {[string length $w]} {
set top [toplevel $w]
} else {
set top .
}
set bar [menu $w.menu]
$top configure -menu $bar
set m [menu $bar.menu]
$bar add cascade -menu $m -label File
$m add command -label "Hit Me" -command [list hitme $top]
$m add command -label "Exit" -command [list destroy $top]
button $w.button -text "Hit Me" -command [list hitme $top]
pack $w.button -padx 20 -pady 20
}
proc hitme w {
tk_messageBox -parent $w -type ok -title "Hit Me" -message "You hit
me!"
}
foreach w {{} .t0 .t1 .t2 .t0.t1 .t0.t2 .t1.t1 .t2.t1} {
mktop $w
}
# Invocation; (UNIX) wish this-script
# (Windows) double-click in explorer
#
# Opens some toplevel windows where you can press a button or activate a
menu item
# in order to get a standard "ok" type dialog box. The dialog box should
be application
# modal which is not the case if run on windows.
ObservedBehavior:
UNIX: the script behaves as expected, ie the dialog boxes are modal
(local grab).
Windows 9X/NT: the modality is restricted to the toplevel on whose
behalf the dialog box is popped up.
If a menu is torn off before the "Hit Me" button is pressed, another
dialog box can be opened by activating the
tear off menu. Sometimes an application crash happens if the main
toplevel window (= .) is closed.
MacOS: not tested
DesiredBehavior:
As the documentation of "tk_dialog" states:
While waiting for the user to respond, tk_dialog sets a local grab.
This prevents the user from interacting with the application in any way
except to invoke the dialog box.
The user cites the tk_dialog docs when complaining about the
tk_messageBox. Indeed, tk_dialog does set an application level
grab, as the docs say, but tk_messageBox does not, nor do the
docs for it claim to. I am dup'ing this to 602, which is an
RFE for a -modal switch on Windows that would take care of this.
-- 01/29/2000 hobbs
|