diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-09-05 14:43:10 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-09-05 14:43:10 (GMT) |
commit | 3218d5200f5e6773c01a6089bbd3ab97a4c0047a (patch) | |
tree | b8e088a1f26c41088ce0acf428e34a2cc12203e5 /library/bgerror.tcl | |
parent | 76689c2d13e9501b11c6154798fa38be7141b130 (diff) | |
download | tk-3218d5200f5e6773c01a6089bbd3ab97a4c0047a.zip tk-3218d5200f5e6773c01a6089bbd3ab97a4c0047a.tar.gz tk-3218d5200f5e6773c01a6089bbd3ab97a4c0047a.tar.bz2 |
* library/bgerror.tcl: [Bugs 3046742,3046750]: Improve keybindings for
the background error dialog, and allow the use of the window manager
controls for closing it (where supported). The Escape key now causes
all remaining background error messages in the queue to be dropped.
Diffstat (limited to 'library/bgerror.tcl')
-rw-r--r-- | library/bgerror.tcl | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl index 8a0dd0b..dec90e7 100644 --- a/library/bgerror.tcl +++ b/library/bgerror.tcl @@ -11,7 +11,7 @@ # Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net> # Copyright (c) 2009 Pat Thoyts <patthoyts@users.sourceforge.net> # -# RCS: @(#) $Id: bgerror.tcl,v 1.41 2010/01/19 01:27:41 patthoyts Exp $ +# RCS: @(#) $Id: bgerror.tcl,v 1.42 2010/09/05 14:43:11 dkf Exp $ # namespace eval ::tk::dialog::error { @@ -30,13 +30,13 @@ namespace eval ::tk::dialog::error { } } -proc ::tk::dialog::error::Return {} { +proc ::tk::dialog::error::Return {which code} { variable button - .bgerrorDialog.ok configure -state active -relief sunken + .bgerrorDialog.$which state {active selected focus} update idletasks after 100 - set button 0 + set button $code } proc ::tk::dialog::error::Details {} { @@ -79,6 +79,17 @@ proc ::tk::dialog::error::Destroy {w} { } } +proc ::tk::dialog::error::DeleteByProtocol {} { + variable button + set button 1 +} + +proc ::tk::dialog::error::ReturnInDetails w { + bind $w <Return> {}; # Remove this binding + $w invoke + return -code break +} + # ::tk::dialog::error::bgerror -- # # This is the default version of bgerror. @@ -142,7 +153,7 @@ proc ::tk::dialog::error::bgerror err { wm withdraw $dlg wm title $dlg $title wm iconname $dlg ErrorDialog - wm protocol $dlg WM_DELETE_WINDOW { } + wm protocol $dlg WM_DELETE_WINDOW [namespace code DeleteByProtocol] if {$windowingsystem eq "aqua"} { ::tk::unsupported::MacWindowStyle style $dlg moveableAlert {} @@ -206,8 +217,10 @@ proc ::tk::dialog::error::bgerror err { # The "OK" button is the default for this dialog. $dlg.ok configure -default active - bind $dlg <Return> [namespace code Return] - bind $dlg <Destroy> [namespace code [list Destroy %W]] + bind $dlg <Return> [namespace code {Return ok 0}] + bind $dlg <Escape> [namespace code {Return dismiss 1}] + bind $dlg <Destroy> [namespace code {Destroy %W}] + bind $dlg.function <Return> [namespace code {ReturnInDetails %W}] $dlg.function configure -command [namespace code Details] # 6. Place the window (centered in the display) and deiconify it. |