Thread Tools Display Modes
02/03/24, 04:25 PM   #1
tealke
Join Date: Mar 2023
Posts: 4
Custom menu for addon

Hello, I have a question, I am new to writing addons and I would like to ask if LibAddonMenu can create a custom addon settings menu window like Shissu or BanditsUI addons. I haven't found a way to do this anywhere and it would be quite useful. Thanks to everyone who can advise me how to do it

Last edited by tealke : 02/03/24 at 04:29 PM.
  Reply With Quote
02/03/24, 04:44 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
LibAddonMenu can only create a settings menu that you find at ESC -> Settings -> AddOns

Though you could reuse the controls of LAM to create your own menu elsewhere but you would have to learn XML and UI creation with lua before that and need to totally do all on your own, LAM is not heping with the totla menu, just providing the controls you could put at the menu (e.g. dropdown, checkbox, ...).

I do not know any tutorial for creating a custom menu.
LAM settings menu tuts can be found at tutorial section (top sticky threads) here at the forums


and at the Wiki (https://wiki.esoui.com/Main_Page):
https://i.imgur.com/oxnMO5M.png


New to addons info can be found here:
https://www.esoui.com/forums/showthread.php?t=9867

Last edited by Baertram : 02/04/24 at 08:25 AM.
  Reply With Quote
02/03/24, 06:47 PM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 655
@tealke

If you take Baertram's advice and pretty much copy LibAddonMenu simply because you don't want your Addon added to the same place as everyone else's, and separate like Shissu the please be extra careful to not break LibAddonMenu so I don't have users telling me their mods work differently then before.

Essentially it's best to add your mod to the same menu as everyone else because it's where people look first. If I am walking someone through over Discord, I don't say press ESC, go to settings, then Addons but look for the other one named Addons that's green... etc. So if you do that then people that don't know where to look will give up. Users don't read documentation or description pages so even if you tell them with a pic on your description page very few people will actually read that.

Keeping it standard is probably the best way to go.
  Reply With Quote
02/03/24, 06:54 PM   #4
tealke
Join Date: Mar 2023
Posts: 4
@Baertram

thanks, that's what I was afraid of. XML files probably wouldn't be such a problem for me, but I'm just getting to know LUA and I don't know if I'll be able to write something similar in this language.....
  Reply With Quote
02/03/24, 06:57 PM   #5
tealke
Join Date: Mar 2023
Posts: 4
@Sharlikran

sure, I understand... I'm not really interested in having the menu separate... but I'm planning an addon with more functions based on the module principle... and I think it's better if it's in a separate menu than if it's mixed between other addons and people had to look hard for it when some "module" turned on the addon function

Last edited by tealke : 02/03/24 at 07:01 PM.
  Reply With Quote
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: 4,989
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
02/04/24, 10:42 AM   #7
tealke
Join Date: Mar 2023
Posts: 4
@Baertram

thank you, I will try according to your instructions
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Custom menu for addon


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