Tk Source Code

View Ticket
Login
Ticket UUID: c0f3263ed17270e8942e54dcb61cf97775676791
Title: Spurious drag after dismissing menu
Type: Bug Version: 8.6.12 on MacOS
Submitter: jal_frezie Created on: 2022-04-30 16:50:45
Subsystem: 01. Bindings Assigned To: marc_culler
Priority: 5 Medium Severity: Severe
Status: Open Last Modified: 2022-05-22 19:32:36
Resolution: None Closed By: nobody
    Closed on:
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}
User Comments: fvogel added on 2022-05-22 19:32:36:
Marc, can you perhaps have a look please? I have no clue.