Sub Panel_Touch (Action As Int, X As Float, Y As Float) As Boolean
Dim p As Panel
p = Sender
If Action = Activity.ACTION_DOWN Then
state = HIGHLIGHTED
Else if state = HIGHLIGHTED and Action = Activity.ACTION_MOVE then
deltaX = abs(X - LastX)
deltaY = abs(Y - LastY)
'On a larger drag remove the highlight
if deltaX > 5dip or deltaY > 5dip then
state = UNHIGHLIGHTED
end if
Else if Action = Activity.ACTION_UP then
state = UNHIGHLIGHTED
End If
if state = HIGHLIGHTED then
p.Color = Colors.White
else
p.Color = Colors.Black
end if
LastX = X
LastY = Y
Return True
End Sub