| Leon Starr 2008-01-24, 7:31 pm |
| I'm using one of Welch's examples to start a canvas app and found that
the two finger scrolling feature on the mac book isn't working as I
had hoped. (Normal drag-the-scrollbar works okay). I'm new to Tcl,
but I assume that this is some kind of scrollbar event binding issue.
A little bit of googling has gotten scrolling in one, but not both
directions to work. Here's the original example:
proc Scrolled_Canvas { c args } {
frame $c
eval {canvas $c.canvas \
-xscrollcommand [list $c.xscroll set] \
-yscrollcommand [list $c.yscroll set] \
-highlightthickness 0 \
-borderwidth 0} $args
scrollbar $c.xscroll -orient horizontal \
-command [list $c.canvas xview]
scrollbar $c.yscroll -orient vertical \
-command [list $c.canvas yview]
grid $c.canvas $c.yscroll -sticky news
grid $c.xscroll -sticky ew
grid rowconfigure $c 0 -weight 1
grid columnconfigure $c 0 -weight 1
return $c.canvas
}
Now the following addition got vertical two-finger scrolling to work:
if {[tk windowingsystem] eq "aqua"} {
bind $c.canvas <MouseWheel> { %W yview scroll [expr {-%D}] units }
}
Has anyone had success getting both x and y scrolling to work? I have
tcl/tk 8.5 on Leopard, by the way.
|