Thread Tools Display Modes
09/10/14, 07:40 PM   #1
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
LibAddonMenu-2.0: Dynamic Menu Options?

Is there a way to get LibAddonMenu-2.0 to re-make your addon's options menu?

For example, if a player is not a vampire at addon load time, information about the vampire skill line is not available. So, it is impossible to add vampire-skill-related options to the menu. But if the player were to become a vampire during that play session, could the vampire skills menu options be added the next time the menu gets opened, or must the player reload the UI?

Does my question make sense?
  Reply With Quote
09/10/14, 08:40 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
#1
You could add vampire related options but have them be disabled if the player is not a vampire. (Using a database of the vampire skill line.)

#2
You can add vampire related options directly (manually) using the LAM 2.0 widget API to the end of your options list.


If you use LAM to create/build your options list for you, then it will only do so when your addon's options window is registered and shown. Anything more advanced than that, and you get into advanced LAM usage.
  Reply With Quote
09/10/14, 09:17 PM   #3
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
Okay, that's what I figured. (I'm probably going to go with option 1, using a local data table as a backup if the real data isn't available.)

Thanks Seerah! This is a fun tool, and I'm enjoying using it!
  Reply With Quote
09/11/14, 08:12 AM   #4
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
I'm using this to rebuild LAM option when someone join / leave a guild.
It rebuild the option panel, works well !

Lua Code:
  1. -- loaded with EVENT_ADD_ONLOADED
  2. function pChat.setup()
  3.    
  4.     -- Menu and pChat.opts vor saved vars
  5.     pChat.init()
  6.    
  7. end
  8.  
  9. -- Initialises the settings and settings menu
  10. function pChat.init()
  11.    
  12.     -- Fetch the saved variables
  13.     pChat.opts = ZO_SavedVars:NewAccountWide('PCHAT_OPTS', 0.9, nil, defaults)
  14.    
  15.     local panelData = {
  16.         type = "panel",
  17.         name = pChat.name,
  18.         displayName = ZO_HIGHLIGHT_TEXT:Colorize("pChat"),
  19.         author = pChat.author,
  20.         version = pChat.version,
  21.         slashCommand = "/pchat",
  22.         registerForRefresh = true,
  23.         registerForDefaults = true,
  24.     }
  25.    
  26.     LAM:RegisterAddonPanel("pChatOptions", panelData)
  27.    
  28.     -- Build OptionTable
  29.     pChat.buildOptionsTable()
  30.    
  31. end
  32.  
  33. -- when my event trigger :
  34. function pChat.newGuild(event)
  35.  
  36.     -- It will rebuild optionsTable and recreate tables
  37.     pChat.buildOptionsTable()
  38.    
  39. end
  40.  
  41. -- Build LAM Option Table, used when AddonLoads or when a player join/leave a guild
  42. function pChat.buildOptionsTable()
  43.  
  44.    local optionsTable = {
  45.         [1] = {
  46.             type = "header",
  47.             name = pChat.lang.optionsH,
  48.             width = "full",
  49.         },
  50.  
  51. ...
  52.    
  53.     LAM:RegisterOptionControls("pChatOptions", optionsTable)
  54.    
  55. end
  Reply With Quote
09/12/14, 12:49 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Without seeing the rest of your pChat.buildOptionsTable function, I don't know what you're doing here. If all you're doing is changing entries in a dropdown menu, there is a much easier way to take care of this.

If you're actually adding/removing options widgets to your settings panel (which I believe is what katkat42 wants to do), then this shouldn't work after you've opened your panel for the first time and the options have been created.
  1. Open your pChat settings panel
  2. Have someone leave/join your guild
  3. Open your pChat settings panel again --> it will be the same as before because it's already been created
  Reply With Quote
09/12/14, 06:21 PM   #6
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Oh, you're right. It's working only if you didn't go on the option panels before..
damn. hopefully for me, users don't go on option panels often.

But it could be a nice feature to add (and there's more than a dropdown menu for me.. 1 header, 2 editbox, 1 drop, and 4 colorsettings per guild)

Thanks in advance?
  Reply With Quote
09/16/14, 04:32 AM   #7
Deome
 
Deome's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 29
Thumbs up Funny, just wrote something for this

Seerah, when DataDaedra is finished consuming my time and patience, I'm hoping to run something by you that is exactly what I think everyone is asking for. Already tested it tonight, just needs a little spit and polish. Nearly done updating DD for 100009 (no sleep till update).

Everyone else: Sit tight
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » LibAddonMenu-2.0: Dynamic Menu Options?

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