summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-04-07 06:31:04 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-04-07 06:31:04 (GMT)
commitc9add176f75de1c563d091ca0c8f2c85fb7a5691 (patch)
tree6a1f5d286c687f98d26a98797fef222899c4503d /library
parentd7593d400af18cb2324c012a674e2bac709e768c (diff)
parentad2bdd9029fd93c161662e44725167d613ea961e (diff)
downloadtk-c9add176f75de1c563d091ca0c8f2c85fb7a5691.zip
tk-c9add176f75de1c563d091ca0c8f2c85fb7a5691.tar.gz
tk-c9add176f75de1c563d091ca0c8f2c85fb7a5691.tar.bz2
Fix [415415fff]: Scale long callback: One click -> Two steps
Diffstat (limited to 'library')
-rw-r--r--library/scale.tcl17
1 files changed, 17 insertions, 0 deletions
diff --git a/library/scale.tcl b/library/scale.tcl
index fb9b81b..466a3ce 100644
--- a/library/scale.tcl
+++ b/library/scale.tcl
@@ -210,7 +210,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} {
@@ -231,14 +244,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]]
}