Catching a swipe Gesture

gorelshv

Member
Licensed User
Longtime User
Hi,
I have a layout with some panels and some view inside those panels.
What I want to do is make this layout catch a swipe gesture (left to right, eg.) without the other views in the layout (specifically inside the panels) catching that gesture (Touch event). Using Activity_touch didn't do much to help.

Thanks.
- Benny
 
Last edited:

gorelshv

Member
Licensed User
Longtime User
I've just read it but, if I put all the panels inside another panel will that panel catch the touch event, even if the other panels have views such as ScrollViews?
BTW, I can't test it right now.
 
Upvote 0

gorelshv

Member
Licensed User
Longtime User
I'll have a look at it later and see. It's been a few days since I had this issue but posted it only now :BangHead:
Will update later. Thanks.
 
Upvote 0

gorelshv

Member
Licensed User
Longtime User
Ok, I tested it again and here's what's going on:
When I Touch (not Click) a view inside a panel the panel's Touch event is not raised. Only if I first touch the panel itself then the touch event is registered. How can I make the panel handle ALL touch events?

EDIT: I did a little bit of searching and found this: http://developer.android.com/resources/articles/gestures.html
How can I implement this in B4A?
 
Last edited:
Upvote 0

gorelshv

Member
Licensed User
Longtime User
I tried the Gestures library by adding a scrollview to the panel but it doesn't catch movements started on the scrollview. What I need is to catch horizontal movements no matter what view the user puts his finger on, just like it's in the link I gave above.

On a side note: using the gestures library I noticed that my tab (Galaxy 7'') supports 10 touch points simultaneously (if i had more fingers i would test for more )
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Erel,
I had tried with a transparent Panel on top to work with the touch event. Could this event be treated like the KeyPress event in returning True or False to indicate the OS wether the event is consumed or not. I tired it but it doesn't work.
Like:
Sub Panele1_Touch (Action As Int, X As Float, Y As Float) As Boolean
Return False

Best regards.
 
Upvote 0

riko

Member
Licensed User
Longtime User
klaus,

do you have success with this?
How have you forward the UP/DOWN events?

I am asking, because i also wanted to have such behavior in my app.
What i want to endup is to move to next/pevious panel only if 2 fingers are used for swiping.
Others should be forwarded to the underlying panel's activity, so that the other views (buttons, boxes) can react.

greetings
Richard.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
No I haven't.
What I tried was using a transparent panel's touch event to move panels forward and backward.
The problem is that on one panel there is a ScrollView, and as the touch event is already consumed by the top transparent panel the ScrollView doesn't scroll anymore. I saw in the Android documentation that the touch event returns True if it has been consumed, so I wondered if the touch event could be treated like the KeyPress event.

Best regards.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…