Widget API: Frame:StartMoving
Jump to navigation
Jump to search
← Widget API ← Frame < StartMoving
Moves the frame-based object in relation to where the mouse is being moved.
obj:StartMoving();
- Arguments
- nil
- Returns
- nil
- Example
myAddonFrame:StartMoving();
- Result
- The frame named 'myAddonFrame' would start to move in relation to where the mouse is being moved.
- Description
- Moves the frame-based object in relation to where the mouse is being moved.
- Use this with the RegisterForDrag() function to allow your frame-based object to be moved by the user.
- Use the StopMovingOrSizing() function inside the <OnDragStop>...</OnDragStop> XML section to stop the moving process.
- Notes
- If the frame becomes stuck by any cause (see SetClampedToScreen()), the mouse and the frame will go off-sync.
- As for Patch 2.3, at the end of the movement the frame will automatically change anchors to the closest point of the parent, on a same-to-same basis (TOPLEFT to TOPLEFT, BOTTOM to BOTTOM...) and, apparently, there isn't a way to prevent this behaviour. This might be a problem if you intend to automatically resize the frame after a user drag - you might find it undesirably aligning itself to the new anchor point, resulting in surprising "jumping around" after a SetWidth() or SetHeight().