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 :)
|
All times are GMT -6. The time now is 08:16 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI