Realbasic.Point.X

From Xojo Documentation

Revision as of 19:04, 13 July 2018 by PLefebvre (talk | contribs)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Property (As Integer )
aRealbasic.Point.X = newIntegerValue
or
IntegerValue = aRealbasic.Point.X

New in 2011r2

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 Realbasic.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