Tk Source Code

View Ticket
Login
Ticket UUID: 7beaed7db68dc05344e1d09d98219315c16cfa15
Title: Typo in ttk binding script in Tk 8.6.11
Type: Bug Version: 8.6.11, core-8-6-branch
Submitter: nemethi Created on: 2021-01-10 17:06:56
Subsystem: 69. Events Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2021-01-12 09:54:04
Resolution: Fixed Closed By: oehhar
    Closed on: 2021-01-12 09:54:04
Description:
Line 308 of the Tk 8.6.11 library file ttk/utils.tcl (proc ttk::bindMouseWheel) contains a syntax error, which throws an error message on Windows:

        bind $bindtag <MouseWheel> "$callback \[expr {-%D/120)}\]"

The closing parenthesis following the 120 should be removed.
User Comments: oehhar added on 2021-01-12 09:54:04:

Yes, I admired your magic. I tested accidently with Tk 8.6.10 and it worked without the invocations of bindMouseWheel. So, I believed your full magic.

Thank you, Harald


nemethi (claiming to be Csaba Nemethi) added on 2021-01-12 09:16:04:
Harald, please forget what I wrote about the two ttk::bindMouseWheel invocations.  Now I had another look at the code and ran some tests, too.  The result is that it doesn't work (it definitely cannot work) if you remove those two lines.  You were right when you wrote that you cannot imagine how ...

oehhar added on 2021-01-11 20:20:26:

Csaba, thanks for the hint. It is true, it works without the two invocations. I can not imagine how, even, if the widget is created first it still works...

IMHO Don should be consulted about the next steps. And Csaba should enter the TCT ;-)

Thanks, Harald


nemethi (claiming to be Csaba Nemethi) added on 2021-01-11 17:05:10:
@Harald: Your fix proposal is OK, but the two ttk::bindMouseWheel invocations can be removed, because they are already contained in combobox.tcl and spinbox.tcl, respectively.

@Jan:
  - Paul Obermeier also released his BAWT for Tcl/Tk 8.6.11 three days ago.
  - Nowadays more and more people use Ttk widgets, e.g., ttk::spinbox rather than tk::spinbox.
  - I fully agree with you that it is a bummer.

jan.nijtmans added on 2021-01-11 16:22:37:

Well, maybe we are lucky. I think most windows users don't build their own distribution but use a pre-compiled one (like magicsplat tcl).

So, if we can convince Ashok P. Nadkarni to patch ttk/utils.tcl before making his new release ....

Oh No! It's already released, and 2,621 people already downloaded it. No-one noticed up to now. It might also be that most applications use spinbox and don't use ttk::spinbox/ttk::combobox. Still, it's a bummer.....


oehhar added on 2021-01-11 12:27:48:

Dear Csaba, dear Jan,

thank you for caring.

I think, the impact of this issue is quite large, as this routine is used for combobox and spinbox bindings.

Here is a proposal of a fix script:

if {[info patchlevel] eq "8.6.11" && [tk windowingsystem] ni {"x11" "aqua"} } {
    proc ::ttk::bindMouseWheel {bindtag callback} {
        bind $bindtag <MouseWheel> "$callback \[expr {-%D/120}\]"
    }
    ttk::bindMouseWheel TCombobox [list ttk::combobox::Scroll %W]
    ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
}

Test:

pack [ttk::combobox .t -values {a b c}]
pack [ttk::spinbox .s]

Is this the way to go ?

Thank you, Harald


jan.nijtmans added on 2021-01-11 07:20:16:

Bummer! Thanks! Fixed now.