Sub Process_Globals
Dim MOVEMENT_THRESHOLD As Int
MOVEMENT_THRESHOLD = 100dip
End Sub
Sub Globals
Dim Panel1 As Panel
Dim StartX As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Panel1.Initialize("Panel1")
Activity.AddView(Panel1, 0, 0, 100%x, 100%y)
End Sub
Sub Panel1_Touch (Action As Int, X As Float, Y As Float) As Boolean 'Return True to consume the event
Select Action
Case Activity.ACTION_DOWN
StartX = X
Case Activity.ACTION_UP
If Abs(X - StartX) > MOVEMENT_THRESHOLD Then
Swipe(X < StartX)
End If
End Select
Return True
End Sub
Sub Swipe(Left As Boolean)
If Left Then Msgbox("Left", "") Else Msgbox("Right", "")
End Sub