I have a problem with MenuSelect event in Tcl/Tk 8.6.11 (tried in Linux, Debian 10.7).
In fact, it doesn't fire at all for the main and tearoff-ed menus. Though working fine in Tcl/Tk 8.6.9, and even in 8.6.11 - only while menus are not tearoff-ed.
A test code:
package require Tk
proc ::somehandler {w wt} {
puts "Step [incr ::step]: $w / $wt, index=[$wt index active]"
}
set w [menu .m -tearoff 1]
$w add command -label {Item 1}
$w add command -label {Item 2}
bind $w <<MenuSelect>> [list ::somehandler $w %W]
pack [button .b -text "Click me" \
-command {tk_popup .m [winfo pointerx .] [winfo pointery .]}]
I tried the following (idiotic though) replacement:
event delete <<MenuSelect>>
event add <<MenuSelect>> <Motion>
bind $w <<MenuSelect>> [list ::somehandler $w %W]
... with the same results.
Seemingly, it's related to menu pathes dealt in Tk somewhat tricky, as seen in the above example.
I'm too lazy to change a standard code at switching from 8.6.9 to 8.6.11/12, 8.7 etc.
TIA for any hints.