Thread Tools Display Modes
09-20-08, 03:35 AM   #1
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Custom Button

I'm trying to make a custom button for my add-on, but so far all I've been able to create is a green placeholder the size of the button. This is the code I have written for it:
Code:
<Button name="$parent_RestoreButton">
   <Size>
      <AbsDimension x="32" y="32"/>
   </Size>
   <Anchors>
      <Anchor point="TOPRIGHT">
         <Offset x="-28" y="-20"/>
      </Anchor>
   </Anchors>
   <Scripts>
      <OnClick>
         RestoreButton_OnClick();
      </OnClick>
   </Scripts>
   <NormalTexture file="Interface\AddOns\MyAddon\Art\ResButtonUp.blp"/>
   <PushedTexture file="Interface\AddOns\MyAddon\Art\ResButtonDown.blp"/>
   <HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
</Button>
I've looked all over and at this point I'm totally stumped as to why this won't work, so if someone could help me out it would be greatly appreciated.
  Reply With Quote
09-20-08, 04:27 AM   #2
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
Any reason you're not creating it in lua? (Maybe its me but it always seems far easier in lua than in xml)

Only thing that occurs to me atm is "don't you have to create a texture?" Ex:

Code:
<Layers>
  <Layer level="BACKGROUND">
    <Texture name="$parent_Icon">
	<Size>
	   <AbsDimension x="30" y="30"/>
	</Size>
        <Anchors>
	  <Anchor point="TOPLEFT">
	    <Offset>
	      <AbsDimension x="0" y="0"/>
	     </Offset>
           </Anchor>
	</Anchors>
	<TexCoords left="0" right="1" top="0" bottom="1"/>
    </Texture>
  </Layer>
</Layers>
Or maybe I shouldn't sit up till 5:30am reading websites...
  Reply With Quote
09-20-08, 05:14 PM   #3
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
You my think lua is easier but I tend to lean toward xml. I just like the way xml does things

I tried your code sample, but now the button is totally transparent. The only reason I even know its still there is 'cause the highlight texture works.
  Reply With Quote
09-20-08, 05:40 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You don't need layer and textures. The button already has textures: <NormalTexture>, <PushedTexture>, and <HighlightTexture>

The "green placeholder" is the texture object without any texture.

My guess is that "Interface\AddOns\MyAddon\Art\ResButtonUp.blp" is a invalid path or "ResButtonUp.blp" is a invalid texture file.

Test your code with these textures:
Code:
<NormalTexture file="Interface\Buttons\UI-PlusButton-Up"/>
<PushedTexture file="Interface\Buttons\UI-PlusButton-Down"/>
<DisabledTexture file="Interface\Buttons\UI-PlusButton-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-PlusButton-Hilight" alphaMode="ADD"/>

Last edited by Duugu : 09-20-08 at 05:43 PM.
  Reply With Quote
09-20-08, 06:39 PM   #5
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Those textures worked, so what do I have to do to be able to use my own textures?
  Reply With Quote
09-20-08, 08:31 PM   #6
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
That's what I get for posting with sleep deprivation :-/

You should be able to just path them in as normal, your example looks ok. Make sure though that the .blp files are themselves valid for textures (if memory serves their dimensions have to be powers of 2). You can nab someone else's .blp file from another addon and rename it to your file to verify you're getting a good file location: if you see the new texture, your .blp file needs some help and if no texture, check your path.
  Reply With Quote
09-20-08, 09:29 PM   #7
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Thumbs up

Yeah WoW didn't like the blp files i was using(created by a paint.net addon). I found a blp converter here and now it works(imagine that).

thank you Duugu and Vincent, i appreciate the help you've given me.

Last edited by Gethe : 09-20-08 at 10:00 PM. Reason: fixed
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Custom 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