8.1.5 ItemButtonTemplate Changes
In 8.1.5 they changed how the item button template works. Instead of being a virtual button that is inherited it is now a new widget type that can be created directly.
Old Way local button = CreateFrame("Button", "ButtonNameHere"..id, ParentFrame, "ItemButtonTemplate"); New Way local button = CreateFrame("ItemButton", "ButtonNameHere"..id, ParentFrame, "OptionalTemplateHere"); |
Hi, thanks for the Info.
Do you know, how we can set the IconBorder or texture with this new way? |
They should still be the same:
xxx.IconBorder:SetTexture(...) xxx:SetNormalTexture(...) |
Were similar changes made to ContainerFrameItemButtonTemplate?
|
It went from inheriting ItemButtonTemplate (because that's now its base widget) to using ContainerFrameItemButtonMixin.
|
Pardon me as I'm not very well-versed in making addons, especially the XML templates.
So, in an XML template, instead of: Code:
<Button inherits="ItemButtonTemplate" /> Code:
<ItemButton /> And, instead of: Code:
<Button inherits="ContainerFrameItemButtonTemplate" /> Code:
<ItemButton inherits="ContainerFrameItemButtonMixin" /> Is this accurate? |
That's sort of it. ItemButtonTemplate is now the base widget ItemButton. It appears to have all the same elements (textures fontstrings etc.) using the same names and parent keys as the original template.
Instead of Code:
<Button name="ContainerFrameItemButtonTemplate" inherits="ItemButtonTemplate" virtual="true"/> Code:
<ItemButton name="ContainerFrameItemButtonTemplate" mixin="ContainerFrameItemButtonMixin" virtual="true"/> Code:
<ItemButton inherits="ContainerFrameItemButtonTemplate"/> |
Thank you very much for the help. With this, I was able to get ArkInventory working again!
|
Hmm I do not get it to work,
This is the way we creating the template: Code:
<ItemButton name="GwPaperDollButtonTemplate" registerForDrag="LeftButton" registerForClicks="LeftButtonUp RightButtonUp" mixin="ContainerFrameItemButtonMixin" virtual="true"> Code:
<ItemButton name="GwPaperDollBagItem" registerForClicks="LeftButtonDown, RightButtonDown" inherits="GwPaperDollButtonTemplate" virtual="true"/> Code:
<ItemButton name="GwPaperDollHeadSlot" parentKey="head" inherits="GwPaperDollButtonTemplate,PaperDollAzeriteItemOverlayTemplate"> Code:
3x ...faceGW2_UI\character/paperdoll_equipment.lua:194: attempt to index field 'IconBorder' (a nil value) Code:
self.IconBorder:SetSize(self:GetSize(), self:GetSize()) |
It's complaining about gwPaperDollBagSlotButton1 not having a key called IconBorder. I can't see from the code supplied what you used to create gwPaperDollBagSlotButton1 (and presumably others).
My guess is you have something like: Lua Code:
Lua Code:
The base widget specified for creating the actual widget overwrites the base widget specified in the template it inherits. Lua Code:
|
Thanks.
Here is the Code to create this: Code:
if _G["gwPaperDollBagSlotButton" .. i] ~= nil then Code:
<ItemButton name="GwPaperDollBagItem" registerForClicks="LeftButtonDown, RightButtonDown" inherits="GwPaperDollButtonTemplate" virtual="true"/> |
Code:
local f = CreateFrame("ItemButton", "gwPaperDollBagSlotButton" .. i, GwPaperDollBagItemList, "GwPaperDollBagItem") Code:
CreateFrame("Button ..) Code:
<Button ..> |
That was it :) Thank you very much :)
Some other short Question: Do you have any idea how we can get the warfront ressources? |
I don't play the game enough to know if there is a difference between war (mission table) resources and warfront resources.
|
I think not, and I do not find any api to get the infos. And also tried to get it via the scenario widget.
|
I thought you were asking how to pick them up in-game :o
Lua Code:
|
Thanks, but with this api you do not get the Metal and Wood Ressourcen from the Warfront secenarios
|
I don't know if or how that information might be obtained. Possibly someone else might know.
|
Lua Code:
|
Thanks, that is it exactly :)
|
I am trying to fix this issue for Altoholic.
We just get this error message when entering the "Character" tab: "Couldn't find inherited node: ItemButtonTemplate" So I assume it is due to the xml codes of AuctionHouse.xml (and Mails.xml respectively): Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> I obviously don't understand the concepts at hand. Simply changing Code:
<Button name="$parentItem" inherits="ItemButtonTemplate"> Code:
<ItemButton name="$parentItem"> "...erface\AddOns\Altoholic_Characters\TabCharacters.lua:72: attempt to index global 'AltoholicFrameAuctions' (a nil value)" Any help would be greatly appreciated. Thanks! |
Assuming for each ItemButton you also simply changed:
Code:
</Button> Code:
</ItemButton> Something in the xml above the line: Code:
<Frame name="AltoholicFrameAuctions" parent="AltoholicTabCharacters" hidden="true"> |
All right, sorry for not being too specific yesterday. This is what's happening now:
I replaced all the occurences of Button in the xml files resulting in this: AuctionHouse.xml Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> When I go to Altoholic's "Characters" tab now, there is no "Couldn't find inherited node: ItemButtonTemplate" error message any more. Instead, now when I try to look at the "Auction House" or "Mails" view, I get errors. But these errors are not even what I ment by "breaks everything"! Because if I do a gui /reload now, I find myself having no message console any more and this error pops up: Code:
Message: Interface\FrameXML\ChatAlertFrameMixin.lua:6: attempt to index global 'DEFAULT_CHAT_FRAME' (a nil value) Similarly, I have no bag icons any more and trying to open my bags pressing "B" results in: Code:
Message: Interface\FrameXML\ContainerFrame.lua:982: attempt to index local 'itemButton' (a nil value) Then it's the same again. Everything OK before I go on Altoholic's "Character" tab (NB without any error messages so far) and then /reload -> leading to the "completely broken" state. Does this make any sense to you? |
I downloaded the addon from WoWI, changed the 2 occurrences of the template and everything seems to work, AH, Mail, Character tab in Altoholic.
Mails.xml Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/"> |
In your two files you also changed the top level template nodes (AltoAuctionEntryTemplate and AltoMailEntryTemplate) from Button to ItemButton even though they never inherited ItemButtonTemplate.
|
@Fizzlemizz: You are so right! I feel really stupid right now. :o
I wanted to try from scratch, so I used the Twitch App's "reinstall" on Altoholic. As a result I got completely new error messages. So I compared the content of my Altoholic folders with that of the downloadable zip file and realised that there were several files completely missing. No idea how this could happen. Maybe the Twitch App got confused by the multitude of single addons Altoholic is comprised of? Anyway I uninstalled Altoholic, then installed anew, applied your changes (i.e. only the Button tags inheriting from ItemButtonTemplate) and everything works fine now. Thank you so much! I guess I should henceforth use Minion instead of Twitch... :p One follow-up question, if I may: Is it possible to make such an xml correction "from outside" the addon? I am working on some other fixes for Altoholic that I can apply by hooking/overriding its public functions in lua. Is something similar possible to override the xml file's content? |
I would say you can't do anything like this with xml virtuals or intrinsics, at least not without some post creation gymnastics in the odd instance where they don't do anything OnLoad.
Someone else may know better. |
Hi.
I have a similar problem with showing itemlevel in Syiana's UI, SUI 7.2. Since he has discontinued the project(stopped playing), I'm trying to fix some few bugs for personal use Here's the code for showing iLvL in the characterpanel and bags(bags work). Does not work after 8.1.5: Lua Code:
Hope someone can help :) |
tkle, you are better off posting this in the Lua/XML help thread in the Developer section of the forums.
Not really to your point, but line 9 contains superfluous code. Lua Code:
Conversely, these are the same: Lua Code:
|
I jumped in this thread because I was also interested in Altoholic issue with ItemButton--thanks for pointing out the erroneous parts.
Just having this opportunity, could someone describe the difference between Button and ItemButton? I know the latter is inherited from Button. |
ItemButtonTemplate used to be a template (xml with the virtual attribute that inherited the button widget and added extra "bits" like frames, textures etc. that was automatically "applied" to any other widget that inherited from ItemButtonTemplate).
Blizzard moved ItemButtonTemplate to being an intrinsic (pseudo widget) ItemButton. In both cases they inherit from the button widget adding the extras. Difference in usage: Code:
local f = CreateFrame("Button", "MyItemButton", UIParent, "ItemButtonTemplate") |
All times are GMT -6. The time now is 05:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI