[PD] support for scrollwheel in patchers
Mathieu Bouchard
matju at sympatico.ca
Fri Mar 26 08:45:43 CET 2004
On Thu, 25 Mar 2004, Hans-Christoph Steiner wrote:
> Hmm, it didn't work for me on MacOS X 10.2.8, Pd 0.37.1, and Tcl 8.4.5.
> It would be nice tho.
On OSX Tcl/Tk, Button-1 is left, Button-2 is right (instead of middle),
Button-3 is middle (instead of right), and Button-4 and Button-5 are
nothing at all, and instead you have to use <MouseWheel> events. That's
what I just found. (Note that apps that run through X11, however, get the
standard XFree86 button numbering)
In addition, the default behaviour for a text widget is to scroll down
when the wheel goes down, but to do nothing when the wheel goes up. (!!!)
So the code that replaces this:
> > bind $name.c <Button-4> "$name.c yview scroll -1 units"
> > bind $name.c <Button-5> "$name.c yview scroll +1 units"
On OSX is:
bind $name.c <MouseWheel> \
"$name.c yview scroll \[expr -abs(%D)/%D\] units"
And to fix the broken scrolling in the console, add this at the end of
proc make_console (impd only):
bind .log.1 <MouseWheel> \
{.log.1 yview scroll [expr -2-abs(%D)/%D] units}
notice the -2 fudge factor... (!)
________________________________________________________________
Mathieu Bouchard http://artengine.ca/matju
More information about the Pd-list
mailing list