summaryrefslogtreecommitdiffstats
path: root/library/scrlbar.tcl
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 09:21:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-25 09:21:04 (GMT)
commit806e7862d404cf9f85f85ff6d4b3e74eb09317f6 (patch)
tree706882fe6334e9de5f11cf853a8b3b69b63b4f3f /library/scrlbar.tcl
parentaa8237ea926f3a1b19e4501879e6d32f6e0b7e6c (diff)
downloadtk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.zip
tk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.tar.gz
tk-806e7862d404cf9f85f85ff6d4b3e74eb09317f6.tar.bz2
New utility function ::tk::MouseWheel
Diffstat (limited to 'library/scrlbar.tcl')
-rw-r--r--library/scrlbar.tcl10
1 files changed, 5 insertions, 5 deletions
diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl
index a8ea3bf..f545785 100644
--- a/library/scrlbar.tcl
+++ b/library/scrlbar.tcl
@@ -130,10 +130,10 @@ bind Scrollbar <<LineEnd>> {
}
bind Scrollbar <MouseWheel> {
- tk::ScrollByUnits %W hv [expr {%D/-30.0}]
+ tk::ScrollByUnits %W hv %D -30.0
}
bind Scrollbar <Option-MouseWheel> {
- tk::ScrollByUnits %W hv [expr {%D/-3.0}]
+ tk::ScrollByUnits %W hv %D -3.0
}
# tk::ScrollButtonDown --
@@ -306,7 +306,7 @@ proc ::tk::ScrollEndDrag {w x y} {
# horizontal, "v" for vertical, "hv" for both.
# amount - How many units to scroll: typically 1 or -1.
-proc ::tk::ScrollByUnits {w orient amount} {
+proc ::tk::ScrollByUnits {w orient amount {factor 1.0}} {
set cmd [$w cget -command]
if {$cmd eq "" || ([string first \
[string index [$w cget -orient] 0] $orient] < 0)} {
@@ -314,9 +314,9 @@ proc ::tk::ScrollByUnits {w orient amount} {
}
set info [$w get]
if {[llength $info] == 2} {
- uplevel #0 $cmd scroll $amount units
+ uplevel #0 $cmd scroll [expr {$amount/$factor}] units
} else {
- uplevel #0 $cmd [expr {[lindex $info 2] + $amount}]
+ uplevel #0 $cmd [expr {[lindex $info 2] + [expr {$amount/$factor}]}]
}
}