WoW:Parent: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(This is information I was unable to find elsewhere. The stub already existed.)
 
mNo edit summary
Line 17: Line 17:


will align the right edge of the child with the left edge of the parent. See [[XML User Interface]] for more details.
will align the right edge of the child with the left edge of the parent. See [[XML User Interface]] for more details.
[[Category:Interface Customization]]

Revision as of 15:54, 22 June 2007

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.