Sub Panel2_Touch (Action As Int, X As Float, Y As Float) As Boolean 'Return True to consume the event
Dim Packet4 As UDPPacket
Dim Data4() As Byte
Log("Action " & Action)
Select Action
Case Activity.ACTION_MOVE
X3 = X - Origx + X3 'get the difference from the origx and x and increment by that value
y3 = Y - Origy + y3 'get the difference from the origy and y and increment by that value
X1 = X3 'assign value of x3 to string x1
Y1 = y3 'assign value of y3 to string y1
If X3 < 0 Then 'set lower boundary for x coordinate
X3 = 0
End If
If X3 > screenwidth * 2 Then 'set higher boundary for x coordinate, i'm using two monitors so i set the high boundary to 1024 * 2
X3 = screenwidth * 2
End If
If y3 < 0 Then 'set lower boundary for y coordinate
y3 = 0
End If
If y3 > screenheight Then 'set higher boundary for y coordinate
y3 = screenheight
End If
coordinates = "xpos"&X1&"ypos"&Y1 'assign x, and y coordinates to coordinates string
Data4 = coordinates.getbytes("ASCII")
Packet4.Initialize(Data4, "10.3.57.20", 11000)
UDPSocket.Send(Packet4) 'send data
' Case Activity.ACTION_UP
'x2 = X
'y2 = Y
Case Activity.ACTION_DOWN
Origx = 0 'on first tap set x coordinates to 0
Origy = 0 'on first tap set y coordinates to 0
End Select
Origx = X 'get initial x location
Origy = Y 'get initial y location
Return True
End Sub