diff options
author | fvogel <fvogelnew1@free.fr> | 2022-04-07 06:31:17 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2022-04-07 06:31:17 (GMT) |
commit | 1028113403405cae6bc0836ae76cd79111ea8770 (patch) | |
tree | 71ee8706f85f93f4c0d99524fccd25464e9f176c /library/scale.tcl | |
parent | 8dcd0c3affd7c9e7220daa443f906abb7842aeb4 (diff) | |
parent | c9add176f75de1c563d091ca0c8f2c85fb7a5691 (diff) | |
download | tk-1028113403405cae6bc0836ae76cd79111ea8770.zip tk-1028113403405cae6bc0836ae76cd79111ea8770.tar.gz tk-1028113403405cae6bc0836ae76cd79111ea8770.tar.bz2 |
Fix [415415fff]: Scale long callback: One click -> Two steps
Diffstat (limited to 'library/scale.tcl')
-rw-r--r-- | library/scale.tcl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/library/scale.tcl b/library/scale.tcl index 0da5472..74d6449 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -202,7 +202,20 @@ proc ::tk::ScaleEndDrag {w} { proc ::tk::ScaleIncrement {w dir big repeat} { variable ::tk::Priv + if {![winfo exists $w]} return + + # give the cancel callback a chance to be serviced if the execution time of + # the -command script lasts longer than -repeatdelay + set clockms [clock milliseconds] + if {$repeat eq "again" && + [expr {$clockms - $Priv(clockms)}] > [expr {[$w cget -repeatinterval] * 1.1}]} { + set Priv(clockms) $clockms + set Priv(afterId) [after [$w cget -repeatinterval] \ + [list tk::ScaleIncrement $w $dir $big again]] + return + } + if {$big eq "big"} { set inc [$w cget -bigincrement] if {$inc == 0} { @@ -223,14 +236,18 @@ proc ::tk::ScaleIncrement {w dir big repeat} { set inc [expr {-$inc}] } } + # this will run the -command script (if any) during the redrawing + # of the scale at idle time $w set [expr {[$w get] + $inc}] if {$repeat eq "again"} { + set Priv(clockms) $clockms set Priv(afterId) [after [$w cget -repeatinterval] \ [list tk::ScaleIncrement $w $dir $big again]] } elseif {$repeat eq "initial"} { set delay [$w cget -repeatdelay] if {$delay > 0} { + set Priv(clockms) $clockms set Priv(afterId) [after $delay \ [list tk::ScaleIncrement $w $dir $big again]] } |