diff options
author | fvogel <fvogelnew1@free.fr> | 2016-03-08 21:56:11 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-03-08 21:56:11 (GMT) |
commit | 42f14fb52f5a0cdf6113741ca6187d7d56fafa32 (patch) | |
tree | 79a38c0207d5138e80f149d603100beb30fdc85c /library | |
parent | d4e3294d3a4adb1370d84500401b26f7279119cc (diff) | |
parent | 23afeb02af6706ac255b77e35f2cc644d2c4e524 (diff) | |
download | tk-42f14fb52f5a0cdf6113741ca6187d7d56fafa32.zip tk-42f14fb52f5a0cdf6113741ca6187d7d56fafa32.tar.gz tk-42f14fb52f5a0cdf6113741ca6187d7d56fafa32.tar.bz2 |
Rebased to core-8-6-branch
Diffstat (limited to 'library')
-rw-r--r-- | library/spinbox.tcl | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 02584f4..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 } @@ -299,6 +301,10 @@ bind Spinbox <B2-Motion> { proc ::tk::spinbox::Invoke {w elem} { variable ::tk::Priv + if {![winfo exists $w]} { + return + } + if {![info exists Priv(outsideElement)]} { $w invoke $elem incr Priv(repeated) @@ -328,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, @@ -351,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 |