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

Documentation / XML guide

Buttons and new types

A button's state textures, label and fonts, and intrinsic frame types.

A button's parts

A <Button> takes the same children as a frame, and a few of its own for how it looks in each state. The texture files here stand for your addon's own art; a texture can also name one of the game's atlases.

<Button name="MyButton" parent="UIParent" registerForClicks="LeftButtonUp, RightButtonUp">
  <Size x="120" y="24"/>
  <Anchors><Anchor point="CENTER"/></Anchors>
  <NormalTexture file="Interface\AddOns\MyAddon\Art\ButtonUp"/>
  <PushedTexture file="Interface\AddOns\MyAddon\Art\ButtonDown"/>
  <HighlightTexture file="Interface\AddOns\MyAddon\Art\ButtonGlow" alphaMode="ADD"/>
  <ButtonText name="$parentText" text="Click me"/>
  <NormalFont style="GameFontNormal"/>
  <HighlightFont style="GameFontHighlight"/>
  <Scripts>
    <OnClick>print("clicked with", button)</OnClick>
  </Scripts>
</Button>
  • State textures: <NormalTexture>, <PushedTexture>, <DisabledTexture>, <HighlightTexture>, and for check buttons <CheckedTexture> and <DisabledCheckedTexture>. Each fills the button unless it has anchors of its own. A name="" gives it a global name, $parent filled in. Blizzard's code finds a chat colour swatch's texture by that name. Guessed which layers these textures are drawn in.
  • <ButtonText> is the button's label: a font string on the ARTWORK layer that takes the element's name. Measured (Retail)
  • <NormalFont>, <HighlightFont>, <DisabledFont> name the font object the label uses in each state.
  • registerForClicks lists the clicks the button answers, and registerForDrag the buttons that start a drag.
  • text="" on the button sets its label, a game string if it names one (Values and text).

Not read yet: <PushedTextOffset>, which moves the label while the button is held, and motionScriptsWhileDisabled. Both are in the element reference's ignored lists.

Intrinsic types: new element names

An element marked intrinsic="true" makes a new element name. After it, <MyEventFrame> can be written like <Frame>: it is built as its base type, a Frame here, with the intrinsic element applied first. Blizzard's own <EventFrame> and <DropdownButton> are made this way.

<Frame name="MyEventFrame" intrinsic="true" mixin="MyEventFrameMixin">
  <Scripts>
    <OnLoad method="OnLoad_Intrinsic"/>
  </Scripts>
</Frame>

<MyEventFrame name="SomeFrame"/>
  • The intrinsic element's handlers run before the frame's own handler for the same script, or after it with intrinsicOrder="postcall".
  • CreateFrame("MyEventFrame") works in Lizzard too. Guessed that it does in the game.