summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-04-30 15:50:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-04-30 15:50:35 (GMT)
commitfb8bb56dc9f0b3c55f022d3e8a17faf163504d9a (patch)
treecced88c7ae19e050fe67d5533cf9567baefd5971 /library
parent59a1799f8fcec30f4e7cf05aad463cccc2b8d307 (diff)
downloadtk-fb8bb56dc9f0b3c55f022d3e8a17faf163504d9a.zip
tk-fb8bb56dc9f0b3c55f022d3e8a17faf163504d9a.tar.gz
tk-fb8bb56dc9f0b3c55f022d3e8a17faf163504d9a.tar.bz2
Experiment: can it be done without a busy wait as well? Not tested on all platforms yet, feedback appreciated!
Diffstat (limited to 'library')
-rw-r--r--library/button.tcl21
1 files changed, 15 insertions, 6 deletions
diff --git a/library/button.tcl b/library/button.tcl
index 16624e7..469a9a8 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -589,6 +589,20 @@ proc ::tk::ButtonUp w {
# Shared routines
##################
+# ::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.
+
+proc ::tk::ButtonInvokeEnd {w oldState oldRelief} {
+ if {[winfo exists $w]} {
+ $w configure -state $oldState -relief $oldRelief
+ uplevel #0 [list $w invoke]
+ }
+}
+
# ::tk::ButtonInvoke --
# The procedure below is called when a button is invoked through
# the keyboard. It simulate a press of the button via the mouse.
@@ -601,12 +615,7 @@ proc ::tk::ButtonInvoke w {
set oldRelief [$w cget -relief]
set oldState [$w cget -state]
$w configure -state active -relief sunken
- update idletasks
- after 100
- if {[winfo exists $w]} {
- $w configure -state $oldState -relief $oldRelief
- uplevel #0 [list $w invoke]
- }
+ after 100 [list ::tk::ButtonInvokeEnd $w $oldState $oldRelief]
}
}