WoW:API CreateFrame: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Categories)
Line 1: Line 1:
local f = CreateFrame("Frame",nil,UIParent)
newFrame = CreateFrame("frameType", "frameName", parentFrame);
Creates a new UI frame.


f:SetFrameStrata("BACKGROUND")
----
;''Arguments''


f:SetWidth(128) -- Set These to whatever height/width is needed
:;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 - Pointer to the parent frame (getglobal("ParentFrameName")).


f:SetHeight(64) -- for your Texture


local t = f:CreateTexture(nil,"BACKGROUND")
;''Returns''


t:SetTexture("Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Factions.blp") -- Set this to your texture file's location
:;newFrame : Frame - Pointer to the newly created frame.


t:SetAllPoints(f)


f.texture = t
;''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()




 
----
 
__NOTOC__
 
{{Template:WoW API}}
f:SetPoint("CENTER",0,0) --This sticks the texture smack dab in the middle of the screen.
 
f:Show()

Revision as of 20:04, 3 April 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 - Pointer to the parent frame (getglobal("ParentFrameName")).


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