This is for Xojo, but will be translated to Swift once I get it to work.
I have a canvas on the screen, the I wish to drag around.
Shouldn’t this work?
Function MouseDown(X As Integer, Y As Integer) Handles MouseDown as Boolean
// get the distance the mouse is from the corner of the canvas
mdx = Me.Left-x
mdy = Me.top-y
Return True
End Function
Sub MouseDrag(X As Integer, Y As Integer) Handles MouseDrag
// move canvas to new location
Me.Left=(x-mdx)
Me.top =(y-mdy)
End Sub
if kinda moves it, flashing and jumping around and sometimes not moving at all