UIHANDLER OnDragStart
Jump to navigation
Jump to search
Invoked when the mouse starts dragging a frame.
(Frame) OnDragStart: self, button
Arguments
- self
- ScriptObject - The frame being dragged
- button
- string :
LeftButton, RightButton, MiddleButton, Button4, Button5
Example
local f = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
f:SetPoint("CENTER")
f:SetSize(200, 200)
f:SetBackdrop(BACKDROP_TUTORIAL_16_16)
f:SetMovable(true)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", function(self, button)
self:StartMoving()
print("OnDragStart", button)
end)
f:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
print("OnDragStop")
end)
- Requires calling SetMouseClickEnabled or EnableMouse since this is not automatically implied by OnDragStart
- Requires calling RegisterForDrag