diff options
author | ericm <ericm> | 2000-04-27 18:28:54 (GMT) |
---|---|---|
committer | ericm <ericm> | 2000-04-27 18:28:54 (GMT) |
commit | 5edcfbff1d764a59b6f8fae30ae320b4fb6c9f6e (patch) | |
tree | e0ffb4a15d12d9f9d9750c22703cf8bb2728e97f /library | |
parent | 37941df832d3f041ab0a1a18e8767498ed62048e (diff) | |
download | tk-5edcfbff1d764a59b6f8fae30ae320b4fb6c9f6e.zip tk-5edcfbff1d764a59b6f8fae30ae320b4fb6c9f6e.tar.gz tk-5edcfbff1d764a59b6f8fae30ae320b4fb6c9f6e.tar.bz2 |
* doc/keysyms.n: Man page enumerating keysyms [RFE: 1645].
* doc/colors.n: Man page enumerating valid color names [RFE: 1645].
* doc/cursors.n: Man page enumerating valid cursor values [RFE: 1645].
* library/msgbox.tcl: Corrected Unix tk_messageBox implementation
to make the first button the default when no default is specified
[Bug: 2218].
* doc/messageBox.n: Updated documentation with regards to
selection of default button when none is specified (now it will
use the first button as the default in that case) [Bug: 2218].
Diffstat (limited to 'library')
-rw-r--r-- | library/msgbox.tcl | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/library/msgbox.tcl b/library/msgbox.tcl index 12857d5..369d4c9 100644 --- a/library/msgbox.tcl +++ b/library/msgbox.tcl @@ -3,7 +3,7 @@ # Implements messageboxes for platforms that do not have native # messagebox support. # -# RCS: @(#) $Id: msgbox.tcl,v 1.10 2000/04/19 09:25:53 hobbs Exp $ +# RCS: @(#) $Id: msgbox.tcl,v 1.11 2000/04/27 18:28:59 ericm Exp $ # # Copyright (c) 1994-1997 Sun Microsystems, Inc. # @@ -214,18 +214,23 @@ proc tkMessageBox {args} { } } - if {[string compare $data(-default) ""]} { - set valid 0 - foreach btn $buttons { - if {[string equal [lindex $btn 0] $data(-default)]} { - set valid 1 - break - } - } - if {!$valid} { - error "invalid default button \"$data(-default)\"" + # If no default button was specified, the default default is the + # first button (Bug: 2218). + + if {$data(-default) == ""} { + set data(-default) [lindex [lindex $buttons 0] 0] + } + + set valid 0 + foreach btn $buttons { + if {[string equal [lindex $btn 0] $data(-default)]} { + set valid 1 + break } } + if {!$valid} { + error "invalid default button \"$data(-default)\"" + } # 2. Set the dialog to be a child window of $parent # |