stevel05 Expert Licensed User Longtime User Nov 7, 2019 #1 The indexfromoffset method returns two different values dependent on where in the item you touch if the list is scrolled such that the first visible view is only partially visible. Attachments CLVItemFromIndex.zip CLVItemFromIndex.zip 9.5 KB · Views: 302
The indexfromoffset method returns two different values dependent on where in the item you touch if the list is scrolled such that the first visible view is only partially visible.
Erel B4X founder Staff member Licensed User Longtime User Nov 8, 2019 #2 You are not using this method correctly: Code: Copy Private Sub Overlay_Touch(ViewTag As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean Log("IndexFromOffset " & CustomListView1.FindIndexFromOffset(Y)) Return False End Sub The offset parameter is relative to the tall inner panel. The valid range of values goes from 0 to CustomListView1.sv.ScrollViewContentHeight. Correct code: Code: Copy Log("IndexFromOffset " & CustomListView1.FindIndexFromOffset(Y + CustomListView1.sv.ScrollViewOffsetY))
You are not using this method correctly: Code: Copy Private Sub Overlay_Touch(ViewTag As Object, Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean Log("IndexFromOffset " & CustomListView1.FindIndexFromOffset(Y)) Return False End Sub The offset parameter is relative to the tall inner panel. The valid range of values goes from 0 to CustomListView1.sv.ScrollViewContentHeight. Correct code: Code: Copy Log("IndexFromOffset " & CustomListView1.FindIndexFromOffset(Y + CustomListView1.sv.ScrollViewOffsetY))