Menu

#2444 Doubleclick lost if processing click/release slow

open
69. Events (88)
5
2008-04-29
2008-04-29
No

This problem occurs under Windows XP and MacOS 10.5 when using ActiveTcl 8.5.2. It also occurs on both those OS using various TclTk 8.4.x. It does not occur under Linux.

Normally if you doubleclick, you get a <Button-1>, <ButtonRelease-1> and <Double-1> event in that order. However, if processing one of the first two takes more than a certain time, the Double event will not be generated at all.

This code snippet illustrates the problem; the loop count of 1e7 is right for my 2GHz core 2 duo MacBook. Interestingly if you divide this delay between the click and release events, the double is generated! But put it all on the release, and it is not.

proc delay {n} {
for {set z 0} {$z < $n} {incr z} {}
}

pack [canvas .c]
.c config -bg beige
bind .c <Button-1> {delay 10000000; .c config -bg green}
bind .c <ButtonRelease-1> {delay 0; .c config -bg yellow}
bind .c <Double-1> {.c config -bg red; puts double}
======

Discussion

MongoDB Logo MongoDB