| Description: |
If you post a menu in front of a widget, either with the post action or the tk_popup command, or even as a dropdown from the menubar, and then dismiss it by clicking in the widget while moving the pointer, a series of B1-Motion events are generated in the widget even after the button is released, and continue to occur until the widget its clicked in again.
If you click outside the Tk window to dismiss the menu, you still get one or two B1-Motion events generated.
Code below allows a right click in the second top-level to post a menu, or it can be cascaded from the menubar, and reports drag events including spurious ones produced by the above procedure.
menu .nt -tearoff 0
toplevel .nr -menu .nt
set m [menu .nr.m -tearoff 0]
foreach nonsense {fee fi fo foo biz baz buzz} {
$m add command -label $nonsense
}
.nt add cascade -label DropDead -menu $m
#bind . <Button-3> {.m post %X %Y}
bind .nr <Button-2> [list tk_popup $m %X %Y]
bind .nr <B1-Motion> {puts %X,%Y}
|