View Single Post
02/04/24, 08:31 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,003
What I sometimes do is use contextmenu via right click at 1 simple button control at my UI.
E.g. directly at the Mail send panel 1 button for mail settings and as you click it LibCustomMenu is used to show a menu with submenus, checkboxes etc. to enables ome setitngs there directly at the mails end panel controls -> See FCOChangeStuff/src/FCOCS_Mail.lua for more details e.g.

Or AddonSelector -> top right at addon list there is 1 button that shows the settings then.

But that's only for stuff like that, and not total addons!

If you want to modularize your addon do the following, using LAM:
Each module needs an own txt file and the ## DependsOn: YourMainAddon tag in the text so your main addon loads first, then the other addons load.
Described here: https://wiki.esoui.com/Addon_manifes...rmat#DependsOn

Make 1 global table MyAddon in your main addon lua files and add a function MyAddon.UpdateSettingsMenu(optionsDataToAdd).
Let the base addon menu create via e.g. function MyAddon.CreateLAMSettings() which uses a table MyAddon.optionsDataToLAM which contains the base controls for your addon.

In your module's lua files create the additional settings for LAM and store them in a table with the LAM format. Then call that global function
MyAddon.UpdateSettingsMenu(optionsDataToAddForThatModule).
Which then adds the optionsDataToAddForThatModule to the MyAddon.optionsDataToLAM table,
and afterwards calls MyAddon.CreateLAMSettings() againto update the LAM settings in total ->new get addded at the bottom with e.g. 1 headline "Module Name 1" and all module's LAm controls below.

Something like this should work

Or another way:
Use the ## DepensdOn: MainAddon at each module's txt
Let all modules load and at their EVENT_ADD_ON_LOADED add some data of settings directly to MyAddon.optionsDataToLAM table.
Then at EVENT_PLAYER_ACTIVATED (which get's called AFTER event_add_on_loaded BUT also at each reloadui and zone change! So make sure you unregister it again after first usage!!!) of the main addon let it build the lam settings based on that MyAddon.optionsDataToLAM once.

Last edited by Baertram : 02/04/24 at 08:34 AM.
  Reply With Quote