summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-18 19:50:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-08-18 19:50:16 (GMT)
commitef0195454b1d958bcad88274c0246d0ac81b781c (patch)
tree9d1d9708dd37a8ef24a1617155d7936aba738c33 /library/demos
parentefac934659acc9da20a8766d8cde87be72e9d1bc (diff)
parent64be854d97cacfa743144a08a60b4ea3b74b484a (diff)
downloadtk-ef0195454b1d958bcad88274c0246d0ac81b781c.zip
tk-ef0195454b1d958bcad88274c0246d0ac81b781c.tar.gz
tk-ef0195454b1d958bcad88274c0246d0ac81b781c.tar.bz2
Refactor all MouseWheel bindings, doing it the same way everywhere. So &lt;MouseWheel&gt; bindings are there on all platforms. Also add bindings for vertical scrolling for iconlist, as suggested by Max Augsburg.
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/cscroll.tcl43
1 files changed, 39 insertions, 4 deletions
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index f6e88f4..f9b6b2b 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -60,19 +60,54 @@ bind $c <2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
if {[tk windowingsystem] eq "aqua"} {
bind $c <MouseWheel> {
- %W yview scroll [expr {- (%D)}] units
+ %W yview scroll [expr {-(%D)}] units
}
bind $c <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
+ %W yview scroll [expr {-10 * (%D)}] units
}
bind $c <Shift-MouseWheel> {
- %W xview scroll [expr {- (%D)}] units
+ %W xview scroll [expr {-(%D)}] units
}
bind $c <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
+ %W xview scroll [expr {-10 * (%D)}] units
+ }
+} else {
+ bind $c <MouseWheel> {
+ %W yview scroll [expr {-(%D / 30)}] units
+ }
+ bind $c <Shift-MouseWheel> {
+ %W xview scroll [expr {-(%D / 30)}] units
}
}
+if {[tk windowingsystem] eq "x11"} {
+ # Support for mousewheels on Linux/Unix commonly comes through mapping
+ # the wheel to the extended buttons. If you have a mousewheel, find
+ # Linux configuration info at:
+ # http://linuxreviews.org/howtos/xfree/mouse/
+ bind $c <4> {
+ if {!$tk_strictMotif} {
+ %W yview scroll -5 units
+ }
+ }
+ bind $c <Shift-4> {
+ if {!$tk_strictMotif} {
+ %W xview scroll -5 units
+ }
+ }
+ bind $c <5> {
+ if {!$tk_strictMotif} {
+ %W yview scroll 5 units
+ }
+ }
+ bind $c <Shift-5> {
+ if {!$tk_strictMotif} {
+ %W xview scroll 5 units
+ }
+ }
+}
+
+
proc scrollEnter canvas {
global oldFill
set id [$canvas find withtag current]