View Single Post
07/01/17, 02:44 AM   #1
BoarGules
 
BoarGules's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2017
Posts: 34
How to get programmatic access to a control defined in XML

With the friendly help I've received on this forum I've succeeded in putting a scene fragment on the Guild Home screen:

Code:
<GuiXml>
  <Controls>
    <TopLevelControl name="MyFragment" hidden="true">
      <Dimensions x="200" y="200" />
      <Anchor point="BOTTOM" relativeTo="ZO_GuildSharedInfo" relativePoint="BOTTOM" offsetX="120" offsetY="680" />
      <Controls>
        <Label name="$(parent)Label" width="200" height="25" font="ZoFontWinH3" inheritAlpha="true"  color="FFFFFF"
            wrapMode="TRUNCATE" verticalAlignment="TOP" horizontalAlignment="CENTER"  text="some text">
          <Anchor point="TOP" relativeTo="$(parent)" relativePoint="TOP" />
        </Label>
      </Controls>
    </TopLevelControl>
  </Controls>
</GuiXml>
Lua Code:
  1. local fragment = ZO_SimpleSceneFragment:New(MyFragment)
  2. GUILD_HOME_SCENE:AddFragment(fragment)

Now I want to change the text of the label control MyFragmentLabel under program control but I can't work out how to get a reference to it.
  Reply With Quote