Menu

#1646 Missing event when posting cascade menus

obsolete: 8.4.5
open
5
2004-01-09
2004-01-09
Simon White
No

Here is an example of the problem found under Linux:

button .b
pack .b
.b configure -activebackground red
menu .m
menu .m.c
.m add cascade -menu ".m.c" -label "cascade"
.b configure -command {tk_popup .m [winfo rootx .b]
[expr [winfo rooty .b] + [winfo height .b]]; .m
activate 1; .m postcascade 1; tk_menuSetFocus .m}

Use the mouse and click on the button and now move the
mouse away. You will see that the buttons state is not
restored to normal and is left as active. Without the
postcascade as soon as you click on the button a
<Leave> event is generated causing the button state to
be restored to normal although the mouse is still
within the widget. Both of these behaviours appear to
not be correct.

I am unable to test the same conditions using
menubutton as I can't see a way to post the cascade
within the same event execution. However menubutton is
slightly different in that the <Leave> event is not
generated until the mouse moves outside the widget.

Discussion

MongoDB Logo MongoDB