swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Swarm-Support] Fix to Tk mousewheel bug


From: Steve Railsback
Subject: [Swarm-Support] Fix to Tk mousewheel bug
Date: Fri, 20 Feb 2009 11:32:07 -0800

OK, thanks to help from Scott Christley and Marcus, here is one way to fix this 
bug. If you installed Swarm on a newer version of Linux, with version 8.4 of 
Tcl/Tk, you might get an error like this when running a model with graphics:

/usr/local/lib/tk8.4/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
    while executing
"bind Listbox <MouseWheel> {
        %W yview scroll [expr {- (%D / 120) * 4}] units
    }"
    invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Listbox <MouseWheel> {
        %W yview scroll [expr {- (%D)}] uni..."
 ...

I made this go away by making two edits in Tk, then re-compiling and installing 
Tk, Blt, and Swarm. The two edits are:

in tk8.4.19/library/listbox.tcl, comment out ("#") three lines as shown at the 
end of this code:

# The MouseWheel will typically only fire on Windows and Mac OS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.
if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Listbox <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Listbox <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Listbox <Shift-MouseWheel> {
        %W xview scroll [expr {- (%D)}] units
    }
    bind Listbox <Shift-Option-MouseWheel> {
        %W xview scroll [expr {-10 * (%D)}] units
    }
} else {
  #  bind Listbox <MouseWheel> {
  #      %W yview scroll [expr {- (%D / 120) * 4}] units
  #  }
}

And in tk8.4.19/library/text.tcl also comment out 3 lines:

# The MouseWheel will typically only fire on Windows and MacOS X.
# However, someone could use the "event generate" command to produce
# one on other platforms.

if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
    bind Text <MouseWheel> {
        %W yview scroll [expr {- (%D)}] units
    }
    bind Text <Option-MouseWheel> {
        %W yview scroll [expr {-10 * (%D)}] units
    }
    bind Text <Shift-MouseWheel> {
        %W xview scroll [expr {- (%D)}] units
    }
    bind Text <Shift-Option-MouseWheel> {
        %W xview scroll [expr {-10 * (%D)}] units
    }
} else {
 #   bind Text <MouseWheel> {
 #       %W yview scroll [expr {- (%D / 120) * 4}] units
 #   }
}


---
Steve Railsback
Lang, Railsback & Associates
Arcata, California
www.LangRailsback.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]