View Single Post
07/17/18, 02:13 PM   #1
Dueydoodah
Join Date: Aug 2015
Posts: 6
Should be simple - seems it's not (for me anyway)

I am having trouble understanding the interactions between xml and lua. I have a control:

Code:
<GuiXml>
  <Controls>
    <TopLevelControl name="WhichSetIndicator" mouseEnabled="true" movable="true" clampedToScreen="true">
      <Dimensions x="250" y="25" />
      <Anchor point="BOTTOM" relativeTo="GuiRoot" relativePoint="CENTER" offsetY="-20" />
 
     <OnMoveStop>
          WhichSet.OnIndicatorMoveStop()
     </OnMoveStop>

      <Controls>
        <Label name="$(parent)Label" width="250" height="25" font="ZoFontWinH1" inheritAlpha="true" color="FF0000"
            wrapMode="TRUNCATE" verticalAlignment="TOP" horizontalAlignment="CENTER" text="Main Weapon Set!">
          <Anchor point="TOP" relativeTo="$(parent)" relativePoint="TOP" />
        </Label>
      </Controls>
    </TopLevelControl>
  </Controls>
</GuiXml>
I would like to change the 'text' element during a keypress event which I already have working. I just can't find the correct way to change the text. I would imagine I could do something like this:

Code:
function WhichSet.OnActionBarChange(event, actionbar)
	if WhichSet.whichActionBar ~= GetActiveWeaponPairInfo() then
		WhichSet.whichActionBar = GetActiveWeaponPairInfo()
	end

	if WhichSet.whichActionBar == 1 then
		WhichSetAddonIndicator:SetText("Main weapon set!")
	else
		WhichSetAddonIndicator:text("Secondary weapon set!")
	end

end
As you might have guessed, the red lines do not work. Can someone help?
  Reply With Quote