LAM2 callbacks - sirinsidiator/ESO-LibAddonMenu GitHub Wiki
LibAddonMenu currently offers four callbacks which can be used to create advanced behaviours outside of the capabilities of LAM itself. All callbacks fire on the global callback manager and receive the currently affected panel as their first parameter. You need to compare this to the reference you receive from RegisterAddonPanel to ensure you only react to your own panel.
Fires after all controls for a specific LAM panel have been created when it is first opened.
CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(panel)
if panel ~= myPanel then return end
-- do something
end)
Fires when a LAM panel is opened on entering the menu or selecting a specific addon (after controls have been created). Only fires once, even when the same addon is selected multiple times in a row.
CALLBACK_MANAGER:RegisterCallback("LAM-PanelOpened", function(panel)
if panel ~= myPanel then return end
-- do something
end)
Fires whenever a LAM panel needs to refresh its controls. This callback may fire multiple times in a row, so make sure to keep your code lightweight. Also make sure to never trigger another refresh inside the callback or you may crash the game.
CALLBACK_MANAGER:RegisterCallback("LAM-RefreshPanel", function(panel)
if panel ~= myPanel then return end
-- do something
end)
Fires when a LAM panel is closed, either because the menu was left, or a different addon panel was selected.
CALLBACK_MANAGER:RegisterCallback("LAM-PanelClosed", function(panel)
if panel ~= myPanel then return end
-- do something
end)