WoW:API CreateFrame: Difference between revisions

Reformat. Add info on "inheritsFrame" parameter added in 1.11.
(corrected 3rd argument, noted the information from slouken that it needs to be an actual ui object and not a string)
(Reformat. Add info on "inheritsFrame" parameter added in 1.11.)
Line 1: Line 1:
newFrame = CreateFrame("frameType", "frameName", parentFrame);
{{wowapi}} __NOTOC__
 
Creates a new UI frame.
Creates a new UI frame.


----
newFrame = CreateFrame("frameType", "frameName", parentFrame[, "inheritsFrame"]);
;''Arguments''
 
== Parameters ==
=== Arguments ===


:;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 - The frame object that will be used as the created Frame's parent (cannot be a string!)
:;parentFrame : Frame - The frame object that will be used as the created Frame's parent (cannot be a string!)
:;inheritsFrame : String - Name of a (virtual) frame to inherit (the same as in XML)


 
=== Returns ===
;''Returns''


:;newFrame : Frame - Pointer to the newly created frame.
:;newFrame : Frame - Pointer to the newly created frame.




;''Example''
== Example ==
Result: displays the horde and alliance insignias in the middle of the screen.
Result: displays the horde and alliance insignias in the middle of the screen.
  local f = CreateFrame("Frame",nil,UIParent)
  local f = CreateFrame("Frame",nil,UIParent)
Line 31: Line 34:




----
== Notes ==
__NOTOC__
 
{{Template:WoW API}}
* CreateFrame() was added in 1.10
* The fourth argument, inheritFrame, was added in 1.11
Anonymous user