In what sub do you usually store the mouse x,y position to init dragging of an object to allow smooth calculated dragging of objects? (in this case an image)
since this is not triggered when dragging begins. Is there a MouseDraggedBegins event or how you solve that?
B4X:
public Sub xIcon_MouseClicked (EventData As MouseEvent)
'fx.Msgbox(Main.MainForm, "Clicked!!", "")
StoreClickPosX = currentMouseX
StoreClickPosY = currentMouseY
Log("Position stored")
End Sub
@Cableguy I was assuming that the initial storage of the x,ypostion should be done in one of the below events, but perhaps another event should be used.
-Storing x and y is used to avoid the glitch and "jump" of the object at the beginning of dragging that is. This is usually done is the MouseClick event in C sharp, but my old method didn't work in B4J. Thereby my question.
Private Sub xpnl_test_Touch(Action As Int, X As Float, Y As Float) As Boolean
If Action = xpnl_test.TOUCH_ACTION_DOWN Then
donwx = X
downy = y
Else if Action = xpnl_test.TOUCH_ACTION_MOVE Then
xpnl_test.Top = xpnl_test.Top + y - downy
xpnl_test.Left = xpnl_test.Left + x - donwx
End If
Return True
End Sub