Hello,
Im having some trouble with the ScrollView2D library.
In my app I have ScrollView2D that is used for a table where there are several columns each as wide as the screen.
When I scroll around I would like to center the scrollview to the nearest column viw smoothscroll. For this I made a sub ScrollChanged.
The first problem is that this event is raised about 20 to 30 times in a go if I scroll around.
The second problem is that I can not set the scrollview position. The App just hangs. I suppose that I somwehow create a never ending loop.
How could I solve this in a stable manner?
Thanks a lot!
Im having some trouble with the ScrollView2D library.
In my app I have ScrollView2D that is used for a table where there are several columns each as wide as the screen.
When I scroll around I would like to center the scrollview to the nearest column viw smoothscroll. For this I made a sub ScrollChanged.
The first problem is that this event is raised about 20 to 30 times in a go if I scroll around.
The second problem is that I can not set the scrollview position. The App just hangs. I suppose that I somwehow create a never ending loop.
B4X:
Sub sview_ScrollChanged(PosX As Int, PosY As Int)
Dim pos As Float
pos = PosX / columnwidth
If pos < 0.5 Then
pos = 0'center first column
Else If pos < 1.5 Then
pos = 1'center second column
Else If pos < 2.5 Then
pos = 2'center third column
Else If pos < 3.5 Then
pos = 3'center forth column
Else If pos < 4.5 Then
pos = 4'center fith column
Else If pos < 5.5 Then
pos = 5'center sixth column
End If
sview.SmoothScrollTo((pos*columnwidth), currentY)
DoEvents
End Sub
How could I solve this in a stable manner?
Thanks a lot!