how to distinguish if Button lost focus by "up" or move out the size

raaiman

Member
Licensed User
Longtime User
:sign0085:
how to distinguish if Button lost focus by "up" or move out the size ?

when have receive the up event ,is lost focus .

when move our finger our or the scope of the button, will receive the event "up" too.


how to distinguish them?


thanks
 

sorex

Expert
Licensed User
Longtime User
Never thought about that one, in flash you had onReleaseOutside events but here we don't seem to have this.

The only thing I can think of is placing the button in a panel. there you have X & Y coordinated from where the press and release happends.

But that will make you probject more complex.


Edit: I tried this but that didn't help either, it still causes an up event when leaving the button, which is actually correct
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
In several apps I use Panels instead of buttons and manage all in the Touch event.
Knowing the x and y coordinates you know where you are and can handle according to it.
I use it to display tooltips:
- in DOWN I display the tooltip
- in MOVE I check if the 'finger' is in the Panel area or not and change the tooltip.
- in UP I execute the function if the 'finger' is inside the Panel and do nothing when outsides. This allows the user to check what the button does without executing the function.

Checking the time between DOWN and UP you can simulate Click and LongClick events.

Best regards.
 
Upvote 0
Top