Dynamical LibAddonMenu - ESOUI
Thread Tools Display Modes
08/24/20, 12:02 PM   #1
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 4
Dynamical LibAddonMenu

Hi all,

Whether it is possible to create menu dynamically, when opening the settings menu, with different number of elements?
  Reply With Quote
08/24/20, 01:38 PM   #2
AddOn Author - Click to view addons
Join Date: Feb 2017
Posts: 60
Yes it's possible, you can create the menu elements in a loop and add them to the table of controls that you give to LAM for example
  Reply With Quote
08/24/20, 02:31 PM   #3
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 4
I didn't put it that way, I didn't mean dynamic creation, but dynamic change every time you open Settings. Each time you open it, a new panel is created.
  Reply With Quote
08/24/20, 03:57 PM   #4
Super Moderator
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,053
Check the LAM docu for the possible callback functions you could register, e.g.

Lua Code:
  1. local panelData = {
  2.         type                = 'panel',
  3.         name                = addonVars.addonNameMenu,
  4.         displayName         = addonVars.addonNameMenuDisplay,
  5.         author              = addonVars.addonAuthor,
  6.         version             = addonVars.addonVersionOptions,
  7.         registerForRefresh  = true,
  8.         registerForDefaults = true,
  9.         slashCommand        = "/myaddons",
  10.         website             = addonVars.website,
  11.         feedback            = addonVars.feedback,
  12.         donation            = addonVars.donation,
  13.     }
  14.     --The LibAddonMenu2.0 settings panel reference variable
  15.     myAddon.LAMPanel = LibAddonMenu2:RegisterAddonPanel(addonVars.gAddonName .. "_LAM", panelData)
  17. local function MyLAMPanelCreated(panel)
  18.    --only if MY addon's LAM panel was created
  19.    if panel ~= myAddon.LAMPanel then return end
  20. end
  24.     CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", MyLAMPanelCreated)
  25.     CALLBACK_MANAGER:RegisterCallback("LAM-RefreshPanel", MyLAMPanelRefreshed)
  26.     CALLBACK_MANAGER:RegisterCallback("LAM-PanelOpened", MyLAMPanelOpened)
  27.     CALLBACK_MANAGER:RegisterCallback("LAM-PanelClosed", MyLAMPanelClosed)

LAM-RefreshPanel will be called for each update of any of the controls in the panel!

Not sure if this is what you needed, else describe your usecase in detail/with an example please.
  Reply With Quote
08/24/20, 05:52 PM   #5
AddOn Author - Click to view addons
Join Date: Sep 2018
Posts: 4
Thank you, Baertram. LAM-RefreshPanel this is exactly what I was looking for.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Dynamical LibAddonMenu

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off