For Programmers: Free Programming Magazines  


Home > Archive > Tcl > January 2008 > Getting the touchpad to scroll a tk canvas properly on a MacBook Pro









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Getting the touchpad to scroll a tk canvas properly on a MacBook Pro
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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com