0

I would like to disable an event for a specific type of widget in TCL/TK. Specifically, I don't want the mousewheel to change the selected item in a ttk::combobox. I found bind .widget <<event>> break can be used to unbind. I was able to successfully unbind a ttk::combobox using the following lines.

bind .cb <MouseWheel> break
bind .cb <4> break
bind .cb <5> break

I would like to do this for all ttk::combobox's. I found it is possible with tkinter from this answer, so I am inclined to believe its possible with TCL/TK.

I have tried the following to no avail.

bind ttk::combobox <MouseWheel> break
bind ttk::combobox <4> break
bind ttk::combobox <5> break

I used the bind widget_type <event> procedure format from the manual which contains the lines below.

bind Entry <<Paste>> {puts Paste}
bind Entry <<Scroll>> {puts Scroll}
nikost
  • 788
  • 6
  • 14

1 Answers1

2

I found the problem to be ttk::combobox is not the class name. Changing ttk::combobox to TCombobox fixed the problem.

bind TCombobox <MouseWheel> break
bind TCombobox <4> break
bind TCombobox <5> break
nikost
  • 788
  • 6
  • 14
  • 1
    For arcane reasons relating to how resource names work, widget class names can't (easily) contain colons and must start with a capital letter. It's *very* ugly. If you only need to turn things off for a subset of comboboxes, use the `bindtags` command to give those widgets an extra binding tag (with the right priority) and put your bindings on that. – Donal Fellows Dec 14 '22 at 17:01