Currently on UNIX, mousewheel events are mapped to
mouse buttons 4 and 5. On Windows, there is a separate
<MouseWheel> event. I understand that historically,
buttons 4 and 5 are used on UNIX, but in the interests
of hiding platform-specific details, it would useful to
be able to portably register interest in mousewheel
events, without having to work out how those are
conveyed on a particular platform.
To this end, I propose adding a simple mapping to Tks
script library so that button 4/5 events also generate
an appropriate <MouseWheel> event. This can be done
easily in two lines of code:
bind all <Button-4> {event generate %W <MouseWheel>
-delta 1}
bind all <Button-5> {event generate %W <MouseWheel>
-delta -1}
This seems to get things working on my Linux box. I
haven't looked at the delta values on Windows, so they
may need some tweaking (finding a suitable default
value, and working out whether up is negative or positive).
I think this is a small change, but one which does
quite a lot in hiding platform specific details, in a
backwards-compatible way.
Logged In: YES
user_id=25775
According to a fellow Debian developer, there's a way to ask
X which buttons control ZAxisMapping. (He also informs me
that it's not always 4/5; some people use 6/7.) I'll try to
get more details, maybe even see if I can whip up a proper
patch.
The MouseWheel binding doing nothing on X11 platforms has caused us headaches in our Windows/Mac/Linux molecular visualization program UCSF Chimera. It is one of too many cases where we have to special-case the Tk code depending on operating system. We'd love to see this fixed.