This is a little offtopic, but all button data is stored in tabFilters table, so it would be easier to work with this table:
Lua Code:
local function InvTabSwitch(_tButtonData)
-- do stuff --
end
local function HookBankButtons()
local inventory = PLAYER_INVENTORY:GetDisplayInventoryTable(INVENTORY_BANK)
local tabFilters = inventory.tabFilters
for k,tButtonData in pairs(tabFilters) do
local hCallback = tButtonData.callback
-- Make the SubMenu bar for this button & store it in tButtonData
local button = inventory.filterBar:ButtonObjectForDescriptor(tButtonData.descriptor)
local menuBar = MakeMenuBar(button.m_button)
tButtonData.FilterIt_SubMenu = menuBar
tButtonData.callback = function(...)
InvTabSwitch(...)
hCallback(...)
end
end
end
EDIT: As merlight has explained, "buttonData.control" is not supported by MenuBar / MenuBarButton class and it is not correctly updated by inventory manager. So, I have updated code to get button from descriptor.