Thread Tools Display Modes
04-17-09, 11:37 AM   #1
Telarin
A Murloc Raider
Join Date: Apr 2009
Posts: 8
Using NormalTexture and ButtonText on the same button

Ok, I am trying to have a button in my UI that has both a background texture, and text. This will be used as a column header in a list. I am using the following code in my XML file:


Code:
<Button name="MTFrameSkillListHeader-ItemName" text="Item Name">
        <Size>
          <AbsDimension x="150" y="20"/>
        </Size>
        <Anchors>
          <Anchor point="TOPLEFT" relativeTo="MTFrameSkillList">
            <Offset>
              <AbsDimension x="5" y="-5"/>
            </Offset>
          </Anchor>
        </Anchors>
				<NormalTexture file="Interface\QuestFrame\UI-QuestTitleHighlight">
					<TexCoords left="0.1" right="0.8" top="0" bottom="1"/>
				</NormalTexture>
        <ButtonText name="$parentText">
          <Anchors>
            <Anchor point="CENTER"/>
          </Anchors>
          <FontHeight>
            <AbsValue val="10"/>
          </FontHeight>
        </ButtonText>
        <NormalFont font="GameFontHighlight"/>
      </Button>
unfortunately, this displays ONLY the background texture, and does not show the text on it. Is it possible to do both in the control? If not, what would be the best place to add a fontstring on top of the button, since the button is in the Frames section, which won't take a FontString.
  Reply With Quote
04-17-09, 11:51 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,928
All of my addons are lua only scripting so I can't recall the exact set up in xml format but I found this link that might help you.

http://www.wowwiki.com/FrameXML/DebugUI.xml
  Reply With Quote
04-17-09, 11:58 AM   #3
Telarin
A Murloc Raider
Join Date: Apr 2009
Posts: 8
Hmm, when I try their method, my XML validator tells me that <NormalText> is not a valid child element of <Button>, and of course, no text is displayed in the UI on my button still.
  Reply With Quote
04-18-09, 08:11 PM   #4
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
Replace
Code:
<ButtonText name="$parentText">
with
Code:
<ButtonText name="$parentText" inherits="GameFontHighlight">
and delete
Code:
<NormalFont font="GameFontHighlight"/>
  Reply With Quote
04-20-09, 11:14 AM   #5
Telarin
A Murloc Raider
Join Date: Apr 2009
Posts: 8
Ok, I figured this out. I needed basically this:

Code:
<Button>
  <NormalTexture/>
  <Layers>
    <Layer level="OVERLAY">
      <FontString/>
    </Layer>
  </Layers>
</Button>
Now, according to the .xsd file I am using that came from the wow Addon Studio, Buttons can't have Layers, however, since Blizzard uses the same technique for their own UI elements, I gave it a try, and it worked great.
  Reply With Quote
04-20-09, 12:02 PM   #6
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
You are essentially ignoring an already existing fontstring (accessible from the button tag with what you had previously) and making a second one directly on top of it as a child of the button.

It will work, but... why would you?

Last edited by Exawatt : 04-20-09 at 12:04 PM.
  Reply With Quote
04-20-09, 12:12 PM   #7
Telarin
A Murloc Raider
Join Date: Apr 2009
Posts: 8
Because if your button uses the NormalTexture tag, the client seems to ignore the "text" attribute. Either that or it renders it behind the texture or something. Either way, you get the texture only, and no text. By putting a fontstring in the overlay layer, the text is rendered on top of whatever texture you use.
  Reply With Quote
04-20-09, 12:57 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
The WoW AddOn Studio makes me want to gouge my eyes out with an olive fork.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
04-20-09, 01:25 PM   #9
Exawatt
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 36
Originally Posted by Telarin View Post
Because if your button uses the NormalTexture tag, the client seems to ignore the "text" attribute. Either that or it renders it behind the texture or something. Either way, you get the texture only, and no text.
It didn't in my trials. If you do what I said in my first post, you'll get this on the screen:

(I had to change the anchors because I don't have a "MTFrameSkillList" frame.)

If you do not delete the NormalFont tag, then it does not display. But you don't need it because the information is moved into the ButtonText tag.

I am not familiar with the AddOn Studio, but I can tell you that if what I posted isn't working (or is being shown as an error), then the problem is with AddOn Studio.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Using NormalTexture and ButtonText on the same button


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off