WoW:API CreateFrame: Difference between revisions

list
m (sp)
(list)
Line 11: Line 11:
:;frameName : String - Name of the newly created frame. If nil, no frame name is assigned. Function will also set a global variable of this name to point to newly created frame.
:;frameName : String - Name of the newly created frame. If nil, no frame name is assigned. Function will also set a global variable of this name to point to newly created frame.
:;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)
:;inheritsFrame : String - a comma-delimited list of names of virtual frames to inherit from (the same as in XML), optional.


=== Returns ===
=== Returns ===
Line 35: Line 35:
* CreateFrame() was added in 1.10
* CreateFrame() was added in 1.10
* The fourth argument, inheritFrame, was added in 1.11
* The fourth argument, inheritFrame, was added in 1.11
* In creating frames with CreateFrame(), you cannot use the OnLoad script handler (e.g. Frame:SetScript("OnLoad", ''function'')) since CreateFrame() loads the frame before Frame:SetScript() is called. If you want to use the OnLoad script handler, define the frame in an XML file that is called before the LUA file or call the OnLoad function manually at the end of the LUA file.
* The frame's OnLoad handler, which will only exist if inherited, will be executed during the CreateFrame call. Any OnLoad script handlers set after CreateFrame() will not execute; consider adding any non-inherited OnLoad code directly after a CreateFrame call or using XML frames.
*: ''Considering that the developer is creating the frames with lua, there is not much point in a handler that runs an lua function when the frame is loaded... the developer can just run their code in the lua file that's creating the frame immediately after they create the frame!''