G giagia Member Licensed User Aug 11, 2020 #1 I need to capture event ( swipe, long Press). In b4a I used gesturedetector. how can I do in B4i?
Star-Dust Expert Licensed User Longtime User Aug 11, 2020 #2 On what view do you have to intercept these events? If it were a panel it would be like this B4X: Copy Public Sub Panel_LongClick End Sub Public Sub Panel_Touch(Action As Int, X As Float, Y As Float) Select Action Case 0 ' down Case 1 ' Up Case 2 ' move / drag End Select End Sub Then it depends exactly what you need to achieve Upvote 0
On what view do you have to intercept these events? If it were a panel it would be like this B4X: Copy Public Sub Panel_LongClick End Sub Public Sub Panel_Touch(Action As Int, X As Float, Y As Float) Select Action Case 0 ' down Case 1 ' Up Case 2 ' move / drag End Select End Sub Then it depends exactly what you need to achieve
G giagia Member Licensed User Aug 11, 2020 #3 the view is ScrollView, on it I have line of label Upvote 0
Star-Dust Expert Licensed User Longtime User Aug 11, 2020 #4 giagia said: the view is ScrollView, on it I have line of label Click to expand... The ScrollView already handles and consumes these events. Why do you need to intercept them? Upvote 0
giagia said: the view is ScrollView, on it I have line of label Click to expand... The ScrollView already handles and consumes these events. Why do you need to intercept them?
G giagia Member Licensed User Aug 11, 2020 #5 Star-Dust said: The ScrollView already handles and consumes these events. Why do you need to intercept them? Click to expand... When a user drag on a element of scrollview(right to left) I need to run a method. Last edited: Aug 11, 2020 Upvote 0
Star-Dust said: The ScrollView already handles and consumes these events. Why do you need to intercept them? Click to expand... When a user drag on a element of scrollview(right to left) I need to run a method.
Star-Dust Expert Licensed User Longtime User Aug 11, 2020 #6 giagia said: When a user drag on a element of scrollview(right to left) I need to run a method. Click to expand... When you scroll the ScrollView, this event raises B4X: Copy Public Sub ScrollView_ScrollChanged (OffsetX As Int, OffsetY As Int) End Sub Upvote 0
giagia said: When a user drag on a element of scrollview(right to left) I need to run a method. Click to expand... When you scroll the ScrollView, this event raises B4X: Copy Public Sub ScrollView_ScrollChanged (OffsetX As Int, OffsetY As Int) End Sub
Semen Matusovskiy Well-Known Member Licensed User Aug 11, 2020 #7 As I understand, a scrollview holds some child elements (for example, ImageView) and user can drag them. The easiest solution is to add a panel, which will be a child of RootPanel with maximum z-order index (BringToFront) . Last edited: Aug 11, 2020 Upvote 0
As I understand, a scrollview holds some child elements (for example, ImageView) and user can drag them. The easiest solution is to add a panel, which will be a child of RootPanel with maximum z-order index (BringToFront) .
G giagia Member Licensed User Aug 11, 2020 #8 Semen Matusovskiy said: As I understand, a scrollview holds some child elements (for example, ImageView) and user can drag them. The easiest solution is to add a panel, which will be a child of RootPanel with maximum z-order index (BringToFront) . Click to expand... my panel need to Scrolldown, I put the scrollview into panel but now I can't capture panel_Touch. Upvote 0
Semen Matusovskiy said: As I understand, a scrollview holds some child elements (for example, ImageView) and user can drag them. The easiest solution is to add a panel, which will be a child of RootPanel with maximum z-order index (BringToFront) . Click to expand... my panel need to Scrolldown, I put the scrollview into panel but now I can't capture panel_Touch.
G giagia Member Licensed User Aug 11, 2020 #9 Star-Dust said: When you scroll the ScrollView, this event raises B4X: Copy Public Sub ScrollView_ScrollChanged (OffsetX As Int, OffsetY As Int) End Sub Click to expand... This solution it's ok but OffsetX is always to 0. why? I need to capture horizontal movement ( right to left, and left to right) Upvote 0
Star-Dust said: When you scroll the ScrollView, this event raises B4X: Copy Public Sub ScrollView_ScrollChanged (OffsetX As Int, OffsetY As Int) End Sub Click to expand... This solution it's ok but OffsetX is always to 0. why? I need to capture horizontal movement ( right to left, and left to right)
G giagia Member Licensed User Aug 11, 2020 #10 i found the solution. I have add Scroolview and capture the movement event with: B4X: Copy Sub myScrollview_Touch(Action As Int, X As Float, Y As Float) Select Action Case 0 ' down Case 1 ' Up Case 2 ' move / drag End Select End Sub Upvote 0
i found the solution. I have add Scroolview and capture the movement event with: B4X: Copy Sub myScrollview_Touch(Action As Int, X As Float, Y As Float) Select Action Case 0 ' down Case 1 ' Up Case 2 ' move / drag End Select End Sub
Semen Matusovskiy Well-Known Member Licensed User Aug 11, 2020 #11 Probably, there is a reason to use native gesture recognizer. Not so simple, but not very difficult also. I made a sample. An app detects swipe left/right and hides corresponding view. Attachments s24.zip s24.zip 2.8 KB · Views: 331 Upvote 0
Probably, there is a reason to use native gesture recognizer. Not so simple, but not very difficult also. I made a sample. An app detects swipe left/right and hides corresponding view.
Erel B4X founder Staff member Licensed User Longtime User Aug 12, 2020 #12 Check CLVSwipe: https://www.b4x.com/android/forum/t...pe-actions-and-pull-to-refresh.98252/#content Upvote 0