Android Question Panel touch events


Active Member
Licensed User
Longtime User

There is something fundamental that eludes me with the panel_touch events.
I've read everything i could find, but this only deepens the mystery for me :)
And i find (old) contradictory information, wondering what the latest situation is.

What i need is to capture if the user
- clicked = small abs() difference betheen x-Down and x-Up
- swiped from left to right (or reverse) = big positive or negative difference, but not necessarily
the whole length of the panel.

3 questions if i may:
1. why do i sometimes get (x or y) integers and sometimes decimals (do i use floor to not see that?)
2. what is the meaning of the "as boolean" and "return true" . Return to where? The touch event sub
is not called from the code.
3. Most confusing: when x and y are logged(), you see a series of coordinates between the down and up moment. This means that the touch event continuously fires coordinates between down and up action.
The sub calls another sub which then also gets triggered many times. How to stop that ?

...i must be missing something... :)


Licensed User
Longtime User
You have an "action" parameter in the Touch evento that alows you to differentiate between touch-down, touch-move and touch-down, so you just need to, save the touch-down coordinates, and compare them to the coordinates in the touch up!
But! There is a gesture lib if you need to do more fancy stuff
Last edited:
Upvote 0


Licensed User
Longtime User
1) x and y are Floats in the Touch event. If you display Floats you get the decimal point.
2) This is no more the case. Events have a boolean return value which is by default True.
This feature could be used if you want to do something before the event is returned to the operating system.
It is often used with the Activity_KeyPress event to catch the back button.
If you want to leave the current activity you return False which means Return to the oprating system which pauses the activity.
If you don't want to leave the current activity you return True which means 'consume' the event, this means that the operating system won't get the event, therefore not pausing the activity.
3) It depend where you set the Logs. The Touch event has three modes DOWN, MOVE and UP.
So if you move bit your finger between DOWN and UP, x and y will change.
Upvote 0