Thread Tools Display Modes
08-12-11, 11:08 AM   #1
dreamcatcher
A Black Drake
 
dreamcatcher's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 82
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.
  Reply With Quote
08-12-11, 11:54 AM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Instead of naming UIParent as your frame's parent put a different frame name.

CreateFrame("Frame", "LeftFrame1", Minimap)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-12-11, 12:17 PM   #3
Sniffles
A Black Drake
 
Sniffles's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 86
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.
__________________
Hi!
  Reply With Quote
08-13-11, 06:00 PM   #4
dreamcatcher
A Black Drake
 
dreamcatcher's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 82
Ok so I can anchor the frame to the addon but not vise versa (the addon to the frame)?
  Reply With Quote
08-13-11, 06:30 PM   #5
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
ADDONFRAMENAME:SetParent(YOURFRAMENAME)
__________________
  Reply With Quote
08-16-11, 08:52 PM   #6
dreamcatcher
A Black Drake
 
dreamcatcher's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2010
Posts: 82
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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Parent frame?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off