Thread Tools Display Modes
04-13-06, 11:42 AM   #1
blonda
A Kobold Labourer
Join Date: Apr 2006
Posts: 1
Adding a button to the tradeskill window

i'm trying to add a button to my tradeskill window (in my case alchemy).
i tried the following:
Code:
 
<Button name="MyAddon_Button" parent="TradeSkillFrame" inherits="UIPanelButtonTemplate" text="MYADDON_BUTTON" hidden="true">
    <Size>
        <AbsDimension x="120" y="25" /> 
    </Size>
    <Anchors>
        <Anchor relativePoint="TOP" point="RIGHT">
            <Offset>
                <AbsDimension x="5" y="-53" /> 
            </Offset>
        </Anchor>
    </Anchors>
    <Scripts>
        <OnClick>MyAddon_DoSomething();</OnClick> 
    </Scripts>
</Button>
this results in the button being placed in the middle of the screen, not in any window. my guess is, that's because TradeSkillFrame is defined as virtual and alchemy, blacksmithing, etc are instances of TradeSkillFrame.
does anyone know how i can place a button in those windows? (is it possible at all? never seen an addon that actually changes the tradeskill windows)
  Reply With Quote
01-04-07, 10:42 AM   #2
pert
A Murloc Raider
 
pert's Avatar
Join Date: Apr 2006
Posts: 5
Hi there...

The short answer to your question is:
You need to put this in your .toc file:
Code:
## LoadOnDemand: 1
## LoadWith: Blizzard_TradeSkillUI
The TradeSkillFrame is not virtual:
Code:
<Frame name="TradeSkillFrame" toplevel="true" movable="true" parent="UIParent" enableMouse="true" hidden="true">
If you want your add-on to be for Alchemy only, I think you need to handle that in your script file, cause TradeSkillFrame is used for all trade skills.

FYI: Enchanting is not a Trade Skill in respect to the API, it's a Craft, and hence if you want your add-on to work for Enchanting too, you need to put it in the CraftFrame and load your add-on with Blizzard_CraftUI too.



And here's the longer answer, showing how I found out:

In one add-on I have this:
Code:
<Button 
	  name="Bank2BBButtonExport" 
	  inherits="UIPanelButtonTemplate" 
	  text="Export..." 
	  parent="BankFrame"
	  hidden="false"
  >
		<Size>
			<AbsDimension x="102" y="21"/>
		</Size>
		<Anchors>
			<Anchor point="TOPRIGHT" relativeTo="BankCloseButton" relativePoint="BOTTOM">
  			<Offset>
  				<AbsDimension x="-22" y="-4"/>
  			</Offset>
	    </Anchor>
		</Anchors>
		<Scripts>
			<OnClick>
				Bank2BB:OnExportClick();
			</OnClick>
		</Scripts>
	</Button>
and it works - no problems.

I copy pasted that code into another add-on and roughly replaced "Bank" with "TradeSkill"
Code:
<Button name="TradeSkill2BB_Button" parent="TradeSkillFrame" inherits="UIPanelButtonTemplate" text="Test" hidden="false">
    <Size>
        <AbsDimension x="120" y="21" /> 
    </Size>
    <Anchors>
        <Anchor relativePoint="TOPRIGHT" relativeTo="TradeSkillFrameCloseButton" point="BOTTOM">
            <Offset>
                <AbsDimension x="-22" y="-4" /> 
            </Offset>
        </Anchor>
    </Anchors>
</Button>
Alas... I did not see any button in the trade skill frame.

So of course, I started wondering, what's the difference between BankFrame and TradeSkillFrame.
Most noteworthy difference that appeared to me is that BankFrame is defined in FrameXML, while TradeSkillFrame has been moved to an add-on, Blizzard Trade Skill UI.
I didn't see any noteworthy difference in the XML files. So I went for the .toc files
And there's something there.
The FrameXML.toc file basically just sais:
Code:
# Do not delete the following line!
## Interface: 20000
of course followed by a lot of filenames.
While the Blizzard_TradeSkillUI.toc contains a little more:
Code:
## Interface: 20000
## Title: Blizzard Trade Skill UI
## Secure: 1
## LoadOnDemand: 1
Aha... first of it's Secure. I remembered having read abot some Secure templates in the change notes, so I started digging around for those, but it didn't seem to me to be the solution to this particular problem.

The other thing is the LoadOnDemand. My add-on wasn't LoadOnDemand.
I started browsing this forum to see if any others have had similar problems, and along the way I found the Modifying an Existing Frame thread.

In this regard the important info in there is:
Originally Posted by EricStratton
I got some help from Iriel on the official WoW UI boards. I needed to make my mod load on demand and also have it load with the Auction UI.
I added these two lines to my own .toc:
Code:
## LoadOnDemand: 1
## LoadWith: Blizzard Trade Skill UI
That didn't solve the problem though. The "Blizzard Trade Skill UI" I retrieved from the title in Blizzard_TradeSkillUI.toc. It then hit me that maybe I didn't need the title of the add-on but the auctual directory name of it. And bingo!
Code:
## LoadOnDemand: 1
## LoadWith: Blizzard_TradeSkillUI
Now my button appears. It's placed somewhat weird, but that's an entirely different issue, that I think will be easy to solve .

/PerT

Last edited by pert : 01-04-07 at 10:44 AM.
  Reply With Quote
01-04-07, 10:47 AM   #3
pert
A Murloc Raider
 
pert's Avatar
Join Date: Apr 2006
Posts: 5
And just now, did I realise how old this question was...

*shrugs* Oh well...

Hopefully it will still be helpfull to some.

/PerT
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Adding a button to the tradeskill window


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