Point.X
From Xojo Documentation
Property (As Double )
aPoint.X = newDoubleValue
or
DoubleValue = aPoint.X
New in 2019r2
Supported for all project types and targets.
or
DoubleValue = aPoint.X
New in 2019r2
Supported for all project types and targets.
The horizontal coordinate of the point.
Sample Code
This code is in the MouseDown event handler. The new mouseposition is passed as the X,Y coordinates and mouseoffset is a property of the window.
// Update our mouse position.
mouseposition = New Point(x, y)
// Now we determine which rect our cursor is in
// and save the offset (how far the cursor is inside the rect)
// so when the user moves the cursor, the rect
// won't jump around.
If rectone.Contains(mouseposition) Then
mouseoffset.X = rectone.Origin.X - mouseposition.X
mouseoffset.Y = rectone.Origin.Y - mouseposition.X
draggingrect = rectone
ElseIf recttwo.Contains(mouseposition) Then
mouseoffset.X = recttwo.Origin.X - mouseposition.X
mouseoffset.Y = recttwo.Origin.Y - mouseposition.Y
draggingrect = recttwo
Else
mouseoffset.X = 0
mouseoffset.Y = 0
draggingrect = Nil
End If
// refresh, without erasing the background
Me.Invalidate(False)
Return True
mouseposition = New Point(x, y)
// Now we determine which rect our cursor is in
// and save the offset (how far the cursor is inside the rect)
// so when the user moves the cursor, the rect
// won't jump around.
If rectone.Contains(mouseposition) Then
mouseoffset.X = rectone.Origin.X - mouseposition.X
mouseoffset.Y = rectone.Origin.Y - mouseposition.X
draggingrect = rectone
ElseIf recttwo.Contains(mouseposition) Then
mouseoffset.X = recttwo.Origin.X - mouseposition.X
mouseoffset.Y = recttwo.Origin.Y - mouseposition.Y
draggingrect = recttwo
Else
mouseoffset.X = 0
mouseoffset.Y = 0
draggingrect = Nil
End If
// refresh, without erasing the background
Me.Invalidate(False)
Return True