WoW:Parent: Difference between revisions
(This is information I was unable to find elsewhere. The stub already existed.) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
:''Were you looking for the [[WoWWiki:ParentPage|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. | 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. | ||
Line 17: | Line 18: | ||
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]] |
Latest revision as of 04:48, 15 August 2023
- 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.