Button Down / Up BUG?

DerekTweed

Member
Licensed User
Longtime User
Hello all

I am using Button Down / Up events. They exhibit unexpected behaviour for me. By using Log("DN") and Log("UP") statements in the respective events, I observe that when I touch and hold the button, I get a 'DOWN' event, followed immediately by an 'UP' event, followed by another 'DOWN' event. When I finally release the button, I get an 'UP' event. I've temporarily overcome the problem by counting the UP events, and ignoring odd-numbered ones! The 'DOWN' event sets a flag, and starts a Thread (Only if the flag is clear). The 'UP' event clears the flag, which causes the Thread to exit. By ignoring the extra UP event, the extra DOWN event is rendered ineffective. Any ideas would be welcomed...
 

DerekTweed

Member
Licensed User
Longtime User
Yes, it's my phone - works as expected on Nexus 7 tablet. My phone is a cheap Chinese clone, which I bought for development - doesn't matter if I brick it! Had no other problems so far, though.

Anyway, how to overcome this problem? I did further testing by storing DateTime.Now in DOWN event, and then, in the UP event, subtracting that from the current DateTime.Now. This showed that the erroneous UP event always occurred within 15 mS of the initial DOWN.
So, now I ignore UP events that arrive within 50 mS of the DOWN. Works reliably on both phone and tablet.
 
Top