OAP Lizzard A game interface engine
Game interfaces, outside the game Settings
← XML guide

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>
The names and keys the example makes MyWindow holds Inset, whose global name is MyWindowInset. Inset holds two buttons: the first is MyWindowInsetClose, also Inset.Close and Inset.Buttons[1]; the second has no name and is Inset.Buttons[2]. The close button's anchor walks up two parents from itself, then down to Inset. MyWindow global name MyWindowInset $parent became MyWindow MyWindow.Inset MyWindowInsetClose Inset.Close Inset.Buttons[1] no global name Inset.Buttons[2] relativeKey= "$parent.$parent.Inset" From the close button: 1. $parent: up to Inset 2. $parent: up to MyWindow 3. Inset: MyWindow's key Inset 1 2 3
Global names on top, keys below them. The anchor's key is followed one step at a time: up twice, then down by the key 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" sets parent.Inset to the region, so the window's Lua can say self.Inset.
  • parentArray="Buttons" adds the region to the list parent.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 $parent steps 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 $parent filled in. A lone relativeTo="$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".