A Deviate Faerie Dragon
Join Date: Mar 2009
Posts: 14
|
Help please
Hi im new to all this jst so u now but ive bn fidling around with the draggable frames.I can get the frames to be draged but i cant lock them in place can some 1 plz tell me whats im doing wrong.
here is the code.
-- Spawn Frames --
local player = oUF:Spawn("player", "oUF_Player"):SetPoint("CENTER", -230, -240)
local target = oUF:Spawn("target", "oUF_Target"):SetPoint("CENTER", 231, -240)
local pet = oUF:Spawn("pet", "oUF_pet")
pet:SetPoint("TOPRIGHT", player, "BOTTOMRIGHT", -0, -1)
local tt = oUF:Spawn("targettarget")
tt:SetPoint("TOPRIGHT", target, "BOTTOMRIGHT", 0, -1)
-- Frame Moving Func --
-- move func
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
-- create drag frame func
local function oUF_CreateDragFrame(framename,movable,locked,anchorframe,anchorframename,anchorpoint,xpos,ypos)
local f = CreateFrame("Frame",framename,UIParent)
f:SetWidth(50)
f:SetHeight(50)
if locked ~= 1 then
f:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 }})
end
f:SetPoint(anchorpoint,xpos,ypos)
f:SetFrameStrata("DIALOG")
if anchorframe == nil then
anchorframe = _G[anchorframename]
end
anchorframe:ClearAllPoints()
anchorframe:SetPoint("TOPLEFT", f, "TOPLEFT",0,0)
oUF_MoveThisFrame(framename,movable,locked)
end
--calls
-- oUF_CreateDragFrame(framename,movable,locked,anchorframe,anchorframename,anchorpoint,xpos,ypos)
oUF_CreateDragFrame("oUF_TargetDragFrame",1,0,target,"oUF_Target","CENTER",0,0)
|
id like to thank roth for the code
|