#if B4A
Private Sub mRoot_Touch (o As Object, ACTION As Int, x As Float, y As Float, motion As Object) As Boolean
#else
Private Sub mRoot_Touch (Action As Int, X As Float, Y As Float)
#end if
If Action = mRoot.TOUCH_ACTION_DOWN Then
'mRoot.BringToFront
Dragging = True
DownX = X
DownY = Y
DraggingStart = DateTime.Now
Check_LongClick 'checking if LongTap was made
Else If Action = mRoot.TOUCH_ACTION_UP Then
Dragging = False
MouseClickTimer.Enabled = False 'no LongTap
Else If Dragging And Action = mRoot.TOUCH_ACTION_MOVE Then
#if B4A
If InternalView Then Return True
#else
If InternalView Then Return
#end if
MouseClickTimer.Enabled = False 'no LongTap
'mRoot.Left = ApplyGrid(Max(0, Min(mRoot.Parent.Width - mRoot.Width, mRoot.Left + X - DownX))) 'limited
'mRoot.Top = ApplyGrid(Max(0, Min(mRoot.Parent.Height - mRoot.Height, mRoot.Top + Y - DownY))) 'limited
mRoot.Left = ApplyGrid(mRoot.Left + X - DownX)
mRoot.Top = ApplyGrid(mRoot.Top + Y - DownY)
End If
#if B4A
Return True
#end if
End Sub