Q: Gestures Lib, X-Value ?

Mickego

Member
Licensed User
Longtime User
I tried the Gesture Library and Catched
the X-Value when Pressing a ListView.

No Problem getting the Value

Problem is that the Gesture Catching
kind of Locks the Press of the item
in my ListView (ids).

My Purpose to catch the xvalue
is to use it in the Function for ids_ItemClick

Sub ids_ItemClick(Position As Int,Value As Object)

I can see the X-Value in a ToastMessage,
but the "ids_ItemClick" is never Fired.

Is it not possible to use it like I want ?
 

Mickego

Member
Licensed User
Longtime User
Tried with both True and False Return now ,
but No success :-(

thx Anyway for trying to help me

 
Upvote 0

Mickego

Member
Licensed User
Longtime User
Sometimes a "LongClick" produces
a "ShortClick" but I can not Use it that way :-(

I have different actions on the ListView
depending on Long or Short Click
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Thank you for your feedback.

Here's the declaration of the Down event in GestureDetector:
B4X:
onDown(X As Float, Y As Float, MotionEvent As Object)
...of the SingleTapUp event (you could also use SingleTapUpConfirmed):
B4X:
onSingleTapUp(X As Float, Y As Float, MotionEvent As Object)
...and of the LongPress event:
B4X:
onLongPress(X As Float, Y As Float, MotionEvent As Object)
I can't see where the problem is to get the X and Y coordinates.

I'd like to understand what you mean by "passing events to the object", because Gestures and GestureDetector work the same way (they listen to events; they do not trigger events) and are bound to a specific view (to get its events). Concerning the delegation of events, GestureDetector provides a way to send a MotionEvent to another view as it exports this information; it's impossible with Gestures, which only return basic data.

Even in its first stage, my library never required the Reflection library, so there's maybe a confusion with another library because I don't recognize it here.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Unfortunately, I never found a use for Webview in my applications so I'm totally incompetent to help you with.
I really wonder whether we talk of the same libraries because there's no "touchscreen noise" property in the Agraham's Gestures library (version 1.2).
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Ok I see. Both libraries cannot catch some events because they are intercepted by the view. You can disable this interception by a listview or a scrollview with the following code:
B4X:
    Dim r As Reflector
    r.Target = Your_List
    r.RunMethod2("requestDisallowInterceptTouchEvent", False, "java.lang.boolean")
You have to call this for any touch event with Action = 2 (drag).
Maybe that works also for a WebView.

I looked to the demo of Gestures. Movecount is just there to reduce the number of events to handle. You can safely ignore it. I've heard it was necessary with Android 1.x to limit the number of input events but I have no old device to verify and these early versions have almost disappeared.

About returning True or False: when you get a touchdown event (Action = 0), you have to decide whether your code will process the event and consume it (Return True; the event is not passed to the view).
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
And I see now what's missing in my library. You cannot return True or False for touch events. And I understand now why you used the reflection library to return this boolean. My library has been designed at the beginning to detect gestures like double tap or fling, which is complicated or impossible to do with the Gestures library.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…