diff options
author | fvogel <fvogelnew1@free.fr> | 2016-03-07 20:52:45 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-03-07 20:52:45 (GMT) |
commit | c95a7df9de062d04dcfc5fdc5688d78bfe1358f0 (patch) | |
tree | 3fecba6138de494182f9be7a8aef28d6bd17c48f | |
parent | 05064c00fd8467b71a5d8016d466c0e63ed25f85 (diff) | |
parent | 3a076fb453d7473cf3e8ab0beecb1aabc337c317 (diff) | |
download | tk-c95a7df9de062d04dcfc5fdc5688d78bfe1358f0.zip tk-c95a7df9de062d04dcfc5fdc5688d78bfe1358f0.tar.gz tk-c95a7df9de062d04dcfc5fdc5688d78bfe1358f0.tar.bz2 |
Fixed bug [2981253] - spinbox button frozen in case of repeated depressions
-rw-r--r-- | library/spinbox.tcl | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/library/spinbox.tcl b/library/spinbox.tcl index fecf7d6..1965ed8 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -86,10 +86,12 @@ bind Spinbox <B1-Motion> { ::tk::spinbox::Motion %W %x %y } bind Spinbox <Double-1> { + ::tk::spinbox::ArrowPress %W %x %y set tk::Priv(selectMode) word ::tk::spinbox::MouseSelect %W %x sel.first } bind Spinbox <Triple-1> { + ::tk::spinbox::ArrowPress %W %x %y set tk::Priv(selectMode) line ::tk::spinbox::MouseSelect %W %x 0 } @@ -332,6 +334,35 @@ proc ::tk::spinbox::ClosestGap {w x} { incr pos } +# ::tk::spinbox::ArrowPress -- +# This procedure is invoked to handle button-1 presses in buttonup +# or buttondown elements of spinbox widgets. +# +# Arguments: +# w - The spinbox window in which the button was pressed. +# x - The x-coordinate of the button press. +# y - The y-coordinate of the button press. + +proc ::tk::spinbox::ArrowPress {w x y} { + variable ::tk::Priv + + if {[$w cget -state] ne "disabled" && \ + [string match "button*" $Priv(element)]} { + $w selection element $Priv(element) + set Priv(repeated) 0 + set Priv(relief) [$w cget -$Priv(element)relief] + catch {after cancel $Priv(afterId)} + set delay [$w cget -repeatdelay] + if {$delay > 0} { + set Priv(afterId) [after $delay \ + [list ::tk::spinbox::Invoke $w $Priv(element)]] + } + if {[info exists Priv(outsideElement)]} { + unset Priv(outsideElement) + } + } +} + # ::tk::spinbox::ButtonDown -- # This procedure is invoked to handle button-1 presses in spinbox # widgets. It moves the insertion cursor, sets the selection anchor, @@ -355,20 +386,7 @@ proc ::tk::spinbox::ButtonDown {w x y} { switch -exact $Priv(element) { "buttonup" - "buttondown" { - if {"disabled" ne [$w cget -state]} { - $w selection element $Priv(element) - set Priv(repeated) 0 - set Priv(relief) [$w cget -$Priv(element)relief] - catch {after cancel $Priv(afterId)} - set delay [$w cget -repeatdelay] - if {$delay > 0} { - set Priv(afterId) [after $delay \ - [list ::tk::spinbox::Invoke $w $Priv(element)]] - } - if {[info exists Priv(outsideElement)]} { - unset Priv(outsideElement) - } - } + ::tk::spinbox::ArrowPress $w $x $y } "entry" { set Priv(selectMode) char |