WoW:API CreateFrame: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Categories)
(corrected 3rd argument, noted the information from slouken that it needs to be an actual ui object and not a string)
Line 7: Line 7:
:;frameType : String - Type of the frame to be created (XML tag name): "Frame", "Button"... etc.
:;frameType : String - Type of the frame to be created (XML tag name): "Frame", "Button"... etc.
:;frameName : String - Name of the newly created frame. If nil, no frame name is assigned.
:;frameName : String - Name of the newly created frame. If nil, no frame name is assigned.
:;parentFrame : Frame - Pointer to the parent frame (getglobal("ParentFrameName")).
:;parentFrame : Frame - The frame object that will be used as the created Frame's parent (cannot be a string!)





Revision as of 15:03, 26 May 2006

newFrame = CreateFrame("frameType", "frameName", parentFrame);

Creates a new UI frame.


Arguments
frameType
String - Type of the frame to be created (XML tag name): "Frame", "Button"... etc.
frameName
String - Name of the newly created frame. If nil, no frame name is assigned.
parentFrame
Frame - The frame object that will be used as the created Frame's parent (cannot be a string!)


Returns
newFrame
Frame - Pointer to the newly created frame.


Example

Result: displays the horde and alliance insignias in the middle of the screen.

local f = CreateFrame("Frame",nil,UIParent)
f:SetFrameStrata("BACKGROUND")
f:SetWidth(128)  -- Set These to whatever height/width is needed 
f:SetHeight(64) -- for your Texture

local t = f:CreateTexture(nil,"BACKGROUND")
t:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Factions.blp")
t:SetAllPoints(f)
f.texture = t

f:SetPoint("CENTER",0,0)
f:Show()



Template:WoW API