WoW:Parent

From AddOn Studio
Revision as of 14:54, 14 August 2015 by WoWWiki>Fandyllic
Jump to navigation Jump to search
Were you looking for the Parents' guide page for World of Warcraft?

A parent frame shares certain attributes with its children. For example, a child will automatically move whenever its parent is moved and will show and hide along with its parent.

An AddOn with only one frame will want to use the standard UIParent. See Frames for a list of reasons why this is a good practice.

<Frame name="My_Main_Frame" parent="UIParent">

To create a child frame you must declare an existing frame as its parent.

<Frame name="My_New_Frame" parent="My_Main_Frame">

Important: the table of contents file (.toc) must list the parent frame's xml file before the child's xml file. If this is not done, the child will not be linked to the parent.


The child is not a clone of the parent. You will still need to set its size, backdrop, layers, and scripts. However, the child will be physically attached to the parent for movement. You can use Anchors to position the child with respect to the parent. For example,

<Anchor point="RIGHT" relativePoint="LEFT" />

will align the right edge of the child with the left edge of the parent. See XML User Interface for more details.