Realbasic.Rect.Origin
From Xojo Documentation
This item was deprecated in version 2019r2. Please use Rect.Origin as a replacement. |
Property (As Realbasic.Point )
aRealbasic.Rect.Origin = newRealbasic.PointValue
or
Realbasic.PointValue = aRealbasic.Rect.Origin
Supported for all project types and targets.
or
Realbasic.PointValue = aRealbasic.Rect.Origin
Supported for all project types and targets.
The upper left coordinate of the rect.
Sample Code
This example is in the MouseDrag event. The position of the Rect being dragged is updated via by reseting the value of the Origin property.
// Update our mouse position.
mouseposition = New Realbasic.Point(x, y)
// If we're actually dragging something, move the rect.
// We update the rect's origin with a CLONE of the mouse position,
// because MousePosition is an instance of the REALbasic.Point class.
// Without the clone, when we call the offset function, we'll also update
// the MousePosition property, since both DraggingRect.Origin and MousePosition
// would point to the same variable.
// The offset function simply shifts the rect. Positive for right/down,
// negative for left/up.
If draggingrect <> Nil Then
draggingrect.Origin = mouseposition.Clone
draggingrect.Offset(mouseoffset.x, mouseoffset.y)
End If
// refresh, without erasing the background
Me.Invalidate(False)
mouseposition = New Realbasic.Point(x, y)
// If we're actually dragging something, move the rect.
// We update the rect's origin with a CLONE of the mouse position,
// because MousePosition is an instance of the REALbasic.Point class.
// Without the clone, when we call the offset function, we'll also update
// the MousePosition property, since both DraggingRect.Origin and MousePosition
// would point to the same variable.
// The offset function simply shifts the rect. Positive for right/down,
// negative for left/up.
If draggingrect <> Nil Then
draggingrect.Origin = mouseposition.Clone
draggingrect.Offset(mouseoffset.x, mouseoffset.y)
End If
// refresh, without erasing the background
Me.Invalidate(False)