summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-05-03 17:24:52 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-05-03 17:24:52 (GMT)
commit24bc5ef7c2cec7c5f05169c1903fd481688960c1 (patch)
tree66d0ca9d971be9925bbc17c61534b9430d8fdf22 /library
parentbd753872ec29b543f50c829134d11065533c5cf0 (diff)
parent473bb5cc9b6b28dc7dca5eb9d71b8da7bffac369 (diff)
downloadtk-24bc5ef7c2cec7c5f05169c1903fd481688960c1.zip
tk-24bc5ef7c2cec7c5f05169c1903fd481688960c1.tar.gz
tk-24bc5ef7c2cec7c5f05169c1903fd481688960c1.tar.bz2
Fixed [011706ec42] - tk::ButtonInvoke safety bug
Diffstat (limited to 'library')
-rw-r--r--library/button.tcl19
1 files changed, 16 insertions, 3 deletions
diff --git a/library/button.tcl b/library/button.tcl
index b2bafb2..80d8bf9 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -597,12 +597,25 @@ proc ::tk::ButtonUp w {
# w - The name of the widget.
proc ::tk::ButtonInvoke w {
- if {[$w cget -state] ne "disabled"} {
+ if {[winfo exists $w] && [$w cget -state] ne "disabled"} {
set oldRelief [$w cget -relief]
set oldState [$w cget -state]
$w configure -state active -relief sunken
- update idletasks
- after 100
+ after 100 [list ::tk::ButtonInvokeEnd $w $oldState $oldRelief]
+ }
+}
+
+# ::tk::ButtonInvokeEnd --
+# The procedure below is called after a button is invoked through
+# the keyboard. It simulate a release of the button via the mouse.
+#
+# Arguments:
+# w - The name of the widget.
+# oldState - Old state to be set back.
+# oldRelief - Old relief to be set back.
+
+proc ::tk::ButtonInvokeEnd {w oldState oldRelief} {
+ if {[winfo exists $w]} {
$w configure -state $oldState -relief $oldRelief
uplevel #0 [list $w invoke]
}