Wikia

WoWWiki

XML/LayoutFrame

Talk0
102,225pages on
this wiki

< XML

XML UI ← XML types < LayoutFrame

LayoutFrame is a base type used as a fundamental UI building block for defining UI screen layout. The LayoutFrame type can be used for Size, Position and Animation, and provides a base type for Texture, FontString, Frame, and others. Used as the TitleRegion property.

Inheritance Edit

Inherited by: Frame,Texture,FontString, Inherits: none, Defined in: none

Elements Edit

Attributes Edit

  • name (string) - the name of the element. creates a Lua global variable holding a reference to this element at runtime.
  • parentKey (string) - name for a key in the parent element, which will reference this element at runtime.
  • parentArray (string) - name for an array in the parent, to reference this element at runtime.
  • inherits (string) - Instantiates the element using a virtual element as a template.
  • virtual (boolean) - Defines the element as template, to be inherited from. The element itself is not created.
  • setAllPoints (boolean) - Automatically anchors the TOPLEFT and BOTTOMRIGHT points to the parent.
  • hidden (boolean) - Makes the element hidden by default.

Summary Edit

LayoutFrame based elements facilitate the 'Layout' mechanism in the WoW UI. When used with <Size> along with the <Anchors> element, allow WoW to position all of its visible and interactive elements on the screen, including the 3D views of the world. LayoutFrame works by providing a flexible set of size or positional constructs.

Example Edit

<Frame name="MyFrameTemplate" hidden="true" virtual="true"/>
<Frame name="MyFrame" inherts="MyFrameTemplate">
  <Size x="400" y="400"/>
    <Layers>
      <Layer>
        <FontString parentKey="Name" inherits="MyFont" text="Bob"/>
      </Layer>
    </Layers>
  <Frames>
    <Framename="$parentChild">
      <Size x="200" y="100"/>
      <Anchors>
        <Anchor relativeKey="$parent.Name" point="TOP" relativePoint="BOTTOM">
          <Offset>
            <AbsDimension x="0" y="-22" />
          </Offset>
        </Anchor>
      </Anchors>         
    </frame>
  </Frames>
</Frame>

This example will align the top of the 'child' frame to the bottom of the FontString in 'MyFrame' by using 'parentKey' 'relativeKey' references, and then offset that alignment by -22 vertically. Also demonstrates use of Dimension with Size and Anchor, and using Abs and inline values, as well as use of '$parent' to specify the name of the child where the child 'name' will be 'MyFrameChild' at runtime. Finally this example shows use of 'inherits' and 'virtual' where 'MyFrameTemplate' is inherited by 'MyFrame' causing 'MyFrame' to inherit 'hidden' from 'MyFrameTemplate' making 'MyFrame' hidden by default.

Details Edit

LayoutFrame Names Edit

Gets registered in the LUA global variables. Using the $parent tag on a name refers to the parent's name - or the parent's parent's name, if the parent is unnamed, or even further up. For readability and errors avoiding it's strongly recommended to avoid same names with different letters. You can use "$parent" inside name, this one will be replaced with parent attribute of element to form final name:

<Button name="$parentButton" parent="MyFrame">

gives out "MyFrameButton" name for element. When used without parent attribute it replaces with name of first named parent element. This needs for templates - if you use elements in template they will take name from real parent, not template one:

<Frame name="FrameTemplate" virtual="true">
  ...
  <Button name="$parentButton"/>
  ... 
</Frame">
<Frame name="RealFrame" inherits="FrameTemplate">

will result in creation of element "RealFrame" with "RealFrameButton" inside it. If parent attribute undefined name of container of element used.

<Frame Name="NamedFrame">
  ...
  <Frame>
    ...
    <Button name="$parentButton">
      ...
    </Button>
  </Frame>
</Frame>

Will create button named NamedFrameButton.

Around Wikia's network

Random Wiki