WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Parent frame? (https://www.wowinterface.com/forums/showthread.php?t=41146)

dreamcatcher 08-12-11 11:08 AM

Parent frame?
 
I have made some background frames with borders. But I don't know how to make them have a parent name other then default UIParent. Don't know if I'm explaining this right.

So I will post my code and what I want to be able to do is anchor stuff to my frames ex...Recount, mini map, omen.....

Code:

local function CreateFrames()

local f = CreateFrame("Frame", "LeftFrame1", UIParent)
        f:SetWidth(405) -- Set these to whatever height/width is needed
        f:SetHeight(145) -- for your Texture
        f:SetPoint("BOTTOMLEFT", 0, 0)
                f:SetFrameStrata("BACKGROUND")
                f:SetBackdrop(cfg.Backdrop)
                f:SetBackdropBorderColor(0,0,0)
                f:Show()

local f = CreateFrame("Frame", "MiddleFrame", UIParent)
        f:SetWidth(1120) -- Set these to whatever height/width is needed
        f:SetHeight(145) -- for your Texture
        f:SetPoint("BOTTOM", 0, 0)
                f:SetFrameStrata("BACKGROUND")
                f:SetBackdrop(cfg.Backdrop)
                f:SetBackdropBorderColor(0,0,0)
                f:Show()

local f = CreateFrame("Frame", "RightFrame1", UIParent)
        f:SetWidth(405) -- Set these to whatever height/width is needed
        f:SetHeight(145) -- for your Texture
        f:SetPoint("BOTTOMRIGHT", 0, 0)
                f:SetFrameStrata("BACKGROUND")
                f:SetBackdrop(cfg.Backdrop)
                f:SetBackdropBorderColor(0,0,0)
                f:Show()

end

I have tried naming the UIParent as my frame name but that dos not work.

Seerah 08-12-11 11:54 AM

Instead of naming UIParent as your frame's parent put a different frame name.

CreateFrame("Frame", "LeftFrame1", Minimap)

Sniffles 08-12-11 12:17 PM

Or type /fstack in your Chat and hover the Frames like Recount, Skada, ...

If you know the Frame Name of the AddOn, so you can use it as a Parent.

dreamcatcher 08-13-11 06:00 PM

Ok so I can anchor the frame to the addon but not vise versa (the addon to the frame)?

Mischback 08-13-11 06:30 PM

ADDONFRAMENAME:SetParent(YOURFRAMENAME)

dreamcatcher 08-16-11 08:52 PM

Ok new question on frames. I made the background frames for omen and recount and they work good but now I want to make one main big frame for both omen and recount to be anchored to. Is this possible?

Frames that work.
Code:

if Recount then
        local f = CreateFrame("Frame", "Recount", UIParent)
        f:SetParent(Recount_MainWindow)
        f:SetPoint("BOTTOMLEFT", Recount_MainWindow, -5, -5)
        f:SetPoint("TOPRIGHT", Recount_MainWindow, 5 , -5)
        f:SetFrameStrata("BACKGROUND")
        f:SetBackdrop(cfg.Backdrop)
        f:SetBackdropBorderColor(0,0,0)
end
       
if Omen then
        local f = CreateFrame("Frame", "Omen", UIParent)
        f:SetParent(OmenAnchor)
        f:SetPoint("BOTTOMLEFT", OmenAnchor, -5, -5)
        f:SetPoint("TOPRIGHT", OmenAnchor, 5 , 5)
        f:SetFrameStrata("BACKGROUND")
        f:SetBackdrop(cfg.Backdrop)
        f:SetBackdropBorderColor(0,0,0)
end

Tried this.
Code:

if Recount and Omen then
        local f = CreateFrame("Frame", "RightFrame", UIParent)
        f:SetMovable(true)
        f:EnableMouse(true)
        f:RegisterForDrag("LeftButton")
        f:SetScript("OnDragStart", f.StartMoving)
        f:SetScript("OnDragStop", f.StopMovingOrSizing)
        f:SetPoint("CENTER")
        f:SetWidth(350)
        f:SetHeight(150)
        f:SetFrameStrata("BACKGROUND")
        f:SetBackdrop(cfg.Backdrop)
        f:SetBackdropBorderColor(0,0,0)
end



All times are GMT -6. The time now is 04:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI