summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2019-12-17 20:17:08 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2019-12-17 20:17:08 (GMT)
commitb717b23afc6d2927eea4541805d807f48e85ed85 (patch)
tree390dc770c27278c3bb6b1eab006a3503075df248
parent04d138c167f126414371d8702a819cdb63ace694 (diff)
downloadtk-b717b23afc6d2927eea4541805d807f48e85ed85.zip
tk-b717b23afc6d2927eea4541805d807f48e85ed85.tar.gz
tk-b717b23afc6d2927eea4541805d807f48e85ed85.tar.bz2
Add scrollwheel bindings to ttk::scrollbar. Ticket [2b8fa6fd]
-rw-r--r--library/ttk/scrollbar.tcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index d08e1e2..8415e55 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -17,6 +17,28 @@ bind TScrollbar <ButtonPress-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
+if {[tk windowingsystem] eq "aqua"} {
+ bind TScrollbar <MouseWheel> {
+ ttk::scrollbar::Scroll %W [expr {-(%D)}] units
+ }
+ bind TScrollbar <Option-MouseWheel> {
+ ttk::scrollbar::Scroll %W [expr {-10 * (%D)}] units
+ }
+} else {
+ bind TScrollbar <MouseWheel> {
+ if {%D >= 0} {
+ ttk::scrollbar::Scroll %W [expr {-%D/30}] units
+ } else {
+ ttk::scrollbar::Scroll %W [expr {(29-%D)/30}] units
+ }
+ }
+}
+
+if {[tk windowingsystem] eq "x11"} {
+ bind TScrollbar <4> {ttk::scrollbar::Scroll %W -5 units}
+ bind TScrollbar <5> {ttk::scrollbar::Scroll %W 5 units}
+}
+
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
if {$cmd ne ""} {