Sub InitWindow
MaxWidth = GetDeviceLayoutValues.Width
MaxHeight = GetDeviceLayoutValues.Height
OW.Initialize2(MaxWidth-80dip, MaxHeight-80dip, 64dip, 64dip, "Pnl")
Dim Pnl As Panel = OW.Panel
Dim drwColor As ColorDrawable
drwColor.Initialize2(Colors.ARGB(180, 150, 150, 150),32dip,0,Colors.ARGB(180, 150, 150, 150))
Pnl.Background=drwColor
Dim btn As Button
'Your button Initialize code
GD.SetOnGestureListener(btn, "Gesture")
End Sub
Sub Gesture_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
Select Action
Case GD.ACTION_DOWN
Log($"onDown X,Y:(${x},${y})"$)
preX=x
preY=Y
Animation=DateTime.Now
Case GD.ACTION_MOVE
If DateTime.Now - Animation>50 Then
Animation=DateTime.Now
Log($"onMove X,Y:(${x},${y})"$)
OW.X = Max(0, Min(OW.X + x - preX, MaxWidth - OW.Width))
OW.Y = Max(0, Min(OW.Y + y - preY, MaxHeight - OW.Height))
End If
Case GD.ACTION_UP
Log($"onUp X,Y:(${x},${y})"$)
OW.X = Max(0, Min(OW.X + x - preX, MaxWidth - OW.Width))
OW.Y = Max(0, Min(OW.Y + y - preY, MaxHeight - OW.Height))
End Select
Return True
End Sub