I want to have a series of buttons which act like radio buttons, only one can be chosen at a time. I fould information on
ZO_MenuBarTemplate and it seemed perfect but when I try to use it I get an error.
This is how I set it up.
XML
Lua Code:
<GuiXml>
<Controls>
<Control name="testBar1" inherits="ZO_MenuBarTemplate" virtual="true">
</Control>
</Controls>
</GuiXml>
LUA
Lua Code:
local menuBar = CreateControlFromVirtual("testBar1", GuiRoot, "ZO_MenuBarTemplate")
menuBar:SetAnchor(TOPRIGHT, GuiRoot, TOPRIGHT, 0, 0)
local data = {
descriptor = "fancy",
normal = "EsoUI/Art/Inventory/inventory_tabIcon_weapons_up.dds",
pressed = "EsoUI/Art/Inventory/inventory_tabIcon_weapons_down.dds",
disabled = "EsoUI/Art/Inventory/inventory_tabIcon_weapons_disabled.dds",
highlight = "EsoUI/Art/Inventory/inventory_tabIcon_weapons_over.dds",
callback = function(tabData) d("Menu button clicked") end,
}
local newControl = ZO_MenuBar_AddButton(menuBar, data)
Error
Code:
EsoUI/Libraries/ZO_MenuBar/ZO_MenuBar/lua:383: attempt to index a nil value
stack traceback:
EsoUI/Libraries/ZO_MennuBar/ZO_MenuBar.lua:383: in function 'MenuBar:AddButton'
(tail call): ?
Then the lines of code from my addon which started this off, which is the "ZO_MenuBar_AddButton(menuBar, data)" line 11 in my example above.
I am doing something wrong, can anyone spot what it is?