Private Sub StartScrolling (p As B4XView, OriginalWidth As Float)
taskIndex = taskIndex + 1
Dim myIndex As Int = taskIndex
Dim duration As Int = p.Width / WidthPerSecond * 1000
Do While True
#if B4I
Dim pp As Panel = p
pp.SetLayoutAnimated(duration * 3, 1, -(p.Width - OriginalWidth), p.Top, p.Width, p.Height)
#else
p.SetLayoutAnimated(duration, -(p.Width - OriginalWidth), p.Top, p.Width, p.Height)
#end if
Sleep(duration)
If myIndex <> taskIndex Then Return
Sleep(800)
p.SetLayoutAnimated(0, 0, p.Top, p.Width, p.Height)
If myIndex <> taskIndex Then Return
Loop
End Sub