Some of you may know this already. Blizzard included a new "Drag" functionality some time ago which allows us to drag frames. The position is saved in the layout-cache.txt for each character. If "isUserPlaced" is set to true all the SetPoints will be ignored when there is a value in the layout-cache.txt.
To make this work you need give your oUF frames a global name when you spawn them.
Example
Code:
local player = oUF:Spawn("player", "oUF_Player")
local target = oUF:Spawn("target", "oUF_Target")
Now add the move function at the end and call it.
Code:
local function oUF_MoveThisFrame(frame,moveit,lock)
local f = _G[frame]
if moveit == 1 then
f:SetMovable(true)
f:SetUserPlaced(true)
if lock ~= 1 then
f:EnableMouse(true)
f:RegisterForDrag("RightButton")
f:SetScript("OnDragStart", function(self) self:StartMoving() end)
f:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
end
else
f:IsUserPlaced(false)
end
end
-- function(frame name, movable on/off, frame locked on/off)
oUF_MoveThisFrame("oUF_Player",1,0);
oUF_MoveThisFrame("oUF_Target",1,0);
If you have no more frames that overlap themselves this should work. Hover the frame, hold down the right mousebutton and start pulling the mouse. You can make this function global or local. Your choice.
You still need to give your spawned frames a default SetPoint. This will be used if you set the frame to not movable or if there is no value in the layout-cache.txt.
The function is untested yet.
*Update*
I made a set of two functions that should do it. Thanks Luzzifus
Check:
http://www.wowinterface.com/forums/s...30&postcount=7
You are able to create a dragable frame for spawns of your liking and you can lock those frames when finished.