Documentation / XML guide
Names and keys
$parent in names, parentKey and parentArray, and finding a region by its key.
A region can be found in two ways: by a global name, which any code can use, or by a key in its parent's table, which is local to its window. Blizzard's own code mostly uses keys, so two copies of a window don't fight over one name.
A window, an inset inside it, and buttons inside that
<Frame name="MyWindow" parent="UIParent">
<Frames>
<Frame name="$parentInset" parentKey="Inset">
<Frames>
<Button name="$parentClose" parentKey="Close" parentArray="Buttons">
<Anchors>
<Anchor point="TOPRIGHT" relativeKey="$parent.$parent.Inset"/>
</Anchors>
</Button>
<Button parentArray="Buttons"/>
</Frames>
</Frame>
</Frames>
</Frame>
Inset.Global names and $parent
name="MyWindow" makes a global MyWindow. At the start of a name, $parent is
replaced by the name of the nearest parent that has one, so $parentInset inside MyWindow
is MyWindowInset. A parent with no name is skipped: under an unnamed frame on UIParent,
$parentKid became UIParentKid. Measured (Retail)
Guessed that $parent counts only at the start of a
name, and only spelled exactly so.
parentKey and parentArray
parentKey="Inset"setsparent.Insetto the region, so the window's Lua can sayself.Inset.parentArray="Buttons"adds the region to the listparent.Buttons, making the list if it isn't there yet. Regions go in the order they are built.- A region can have both, as the close button does.
- When the element has neither, its templates can give them (Templates).
Finding another region from XML
An anchor can point at another region in three ways:
relativeKey="$parent.$parent.Inset": a path of keys. Each$parentsteps up to a parent; any other part is a key of the region reached so far. Nothing global is needed.relativeTo="$parentTitle": a global name, with$parentfilled in. A lonerelativeTo="$parent"means the parent itself.- Neither: the region's parent, or the screen when it has none. Measured (Retail) for SetPoint in Lua; XML is taken to do the same.
If the path or name finds nothing, the anchor is left out and Lizzard says so: "anchor target not found".