| Description: |
OriginalBugID: 4254 Bug
Version: 8.3
SubmitDate: '2000-02-28'
LastModified: '2000-03-01'
Severity: MED
Status: UnAssn
Submitter: angie
ChangedBy: hobbs
OS: Windows NT
OSVersion: 4.0sp5
Tk 8.3.0 Bug
ReproducibleScript:
# focuslostbug.tcl
wm title . "New focus"
toplevel .t
wm title .t "Original focus"
update
button .t.b -text "Press me!" -command focusbug
pack .t.b
focus .t
proc focusbug {} {
tk_messageBox -icon question -type yesno -default no -message "Please press a button! Notice how focus shifts" -title "Focus bug"
}
ObservedBehavior:
When using tk_messageBox, or similar dialogs (on WinNT at least), the focus is not reset correctly when the dialog is dismissed. This happens even though the dialog tries to do 'set oldFocus [focus] .... catch {focus $oldFocus}' internally.
The script attached demonstrates this problem. There are two windows, with the focus on one containing a button. Pressing the button brings up a simple dialog, but when that dialog is dismissed the focus is now on the window without the button (the root '.' window).
DesiredBehavior:
Focus should remain where it was before.
Patch:
Using 'focus -force' can solve the problem, but I don't think it's a good solution (at least the focus man page suggests not to use -force).
Comments:
Tk 8.2.3 and 8.3.0 show the bug on WinNT.
Posted To comp.lang.tcl: Posted Successfully
|