Originally Posted by Fizzlemizz
You don't want to actually drag the buttons themselves, you want to activate the container frame onDragxxx
Code:
btn:RegisterForDrag("LeftButton");-- Register for left drag
btn:SetScript("OnDragStart", function(self)
local f = frame:GetScript("OnDragStart") -- Get the frame OnDragStart script
f(frame) -- run it
end);
btn:SetScript("OnDragStop", function(self)
local f = frame:GetScript("OnDragStop") -- Get the frame OnDragStop script
f(frame) -- run it
end);
This requires that the frame creation be above the CreateButton function ie. at the top of the file.
|
The code I proposed actually is dragging the container frame by calling
self:GetParent():StartMoving(). This doesn't require the container frame to be pre-defined since it's accessing it through the button's set parent.