ZAM's Minion, currently in open beta, is a new AddOn manager optimized for use with ESO. Install, update & manage AddOns... Learn more!
Download
(26 Kb)
Download
Updated: 07/20/14 09:35 PM
Pictures
File Info
Compatibility:
Craglorn (1.1)
Updated:07/20/14 09:35 PM
Created:02/14/14 09:28 PM
Downloads:8,067
Favorites:79
MD5:
LibAddonMenu  Updated this week!  Popular! (More than 5000 hits)
Version: 2.0 r13
by: Seerah [More]
LibAddonMenu-2.0 is now released!
Your addons will continue to work under LAM-1.0, however that version of the library will no longer be receiving updates, and you will not receive any benefits of LAM-2.0.

** NOTE: If you have already updated your addon's settings panel to LAM2, but are using a version earlier than r6, please update your copy of the lib in the addon. This will avoid duplicate LAM entries in the game's Settings menu. (This bug does not occur in revisions 6+.)**


LibAddonMenu-2.0 is a library to aid addon authors in creating a configuration GUI for their addons which is located in the game's Settings menu. It supports the ability to have all of a user's addon options located in the same panel.

You may see ZAM_Stats for an example of usage.


HOW TO USE:

--Including the library with your addon--
You may either embed the library and LibStub in your addon and load the files from your addon manifest, or have the library installed like any other normal addon.

If your addon embeds the library, you may place this line in your manifest file, just in case the user also has a standalone version installed.
Code:
## OptionalDependsOn: LibAddonMenu-2.0
If you are depending on the library being installed separately and are not embedding it, then you must include this line in your text file.
Code:
## DependsOn: LibAddonMenu-2.0
Either way you choose, LibStub will ensure that only one copy of the library (the newest revision) is loaded into memory.

When embedding the libary, remove the internal LibAddonMenu-2.0 folder from the main library download. I usually place my libraries in a sub-folder called "libs", but you may put them wherever you like in your addon directory. This is how I would then list the files in my manifest. (LAM2's widget controls are broken out into their own files to keep their code clean - this is why there is so many. Good thing you only have to copy-paste this once!)

Code:
libs\LibAddonMenu-2.0\LibAddonMenu-2.0.lua
libs\LibAddonMenu-2.0\controls\panel.lua
libs\LibAddonMenu-2.0\controls\submenu.lua
libs\LibAddonMenu-2.0\controls\button.lua
libs\LibAddonMenu-2.0\controls\checkbox.lua
libs\LibAddonMenu-2.0\controls\colorpicker.lua
libs\LibAddonMenu-2.0\controls\custom.lua
libs\LibAddonMenu-2.0\controls\description.lua
libs\LibAddonMenu-2.0\controls\dropdown.lua
libs\LibAddonMenu-2.0\controls\editbox.lua
libs\LibAddonMenu-2.0\controls\header.lua
libs\LibAddonMenu-2.0\controls\slider.lua
libs\LibAddonMenu-2.0\controls\texture.lua
(Don't forget to also embed LibStub and have it listed to load prior to LibAddonMenu!)


--Getting the library from LibStub (required)--
Lua Code:
  1. local LAM = LibStub:GetLibrary("LibAddonMenu-2.0")
  2. --OR--
  3. local LAM = LibStub("LibAddonMenu-2.0")
  4.      --returns a reference to the library table


Please see the LAM-2.0 page on my portal for guides and docs, as well as a list of differences between LAM-1.0 and LAM-2.0

Details on LAM2 data tables
2.0 r13
- one last bug ran out from anunder the dresser - I smashed it hopefully!

2.0 r12
- fix one bug another shows up...

2.0 r11
- don't overwrite widgets list if table already exists (in case an external lib or addon registers a new widget type)
- headers, descriptions, submenus and custom widgets now have the ability to update their text when the panel and other controls refresh (simply change the name/text in the controlData table)
- custom controls now have the ability to refresh with other controls and your panel - there is a new optional field in the data table called refreshFunc (when the panel refreshes, this function will be called)

2.0 r10
- fixed display of warning icon for dropdown controls
- update LibStub.lua

2.0 r9
- added Russian locale support for RuESO project
- fixed anchoring issue with addon list (addon names are now properly in the scroll frame, so the few of you with tons installed should have no issue any longer)
- added ability to close submenus from the bottom of the submenu (there is a small strip along the bottom of the submenu that is clickable)
- edited each control to better support custom-created UIs via LAM and the parent passed through to the create functions

2.0 r8
- changed border texture around panel and addon list
- expanded maximum size of submenus from 1500 to 2500

2.0 r7
- shortened game menu entry for French and German localizations (so the text doesn't get cut off)
- fixed checkbox label coloring bug (when a checkbox that is set to "off" is re-enabled by another setting)
- fixed multi-line editbox bug (where text didn't display)
- added mousewheel scrolling for multi-line editboxes

2.0 r6
- added "LAM-PanelControlsCreated" callback when you panel has been shown for the first time and your controls have now been created
- fixed duplicate Addon Settings panels when you have a newer version of LAM overwriting an older version
- finished localizing stuff that wasn't localized yet
- added "sort" field to dropdown control

2.0 r5
- fix RefreshPanel function so that all controls now update
- add RefreshPanel call to ForceDefaults function

2.0 r4
- fix for me being an idiot. Sorry guys ><

2.0 r3
- fixed checkboxes making a sound when just refreshing
- fixed error when the lib is loaded standalone, but no addons are registered with it
- fixed error when LAM updates itself to a newer version (won't try to create two of the same frame)

2.0 r2
- LAM-2.0 is now released! See http://www.esoui.com/portal.php?&id=5&pageid=10 for a list of differences between LAM1 and LAM2, as well as a guide for usage and the library's docs

-----------------
1.0 r8
- updated APIVersion to 100004
- changed submenu so scroll bar doesn't overlap contents
- submenu should hopefully no longer occasionally show up behind the options panel

1.0 r7
- the defaults button now properly hides for each panel (Note: the keybind still works, I can't seem to get rid of that, but at least the prompt is hidden now)
- LAM now supports sub menus! See the description page for docs on usage

1.0 r6
- copy/paste fail when changing the name of an arg. Description titles will no longer hide from you.

1.0 r5
- exposed the widgets created via return

1.0 r4
-new widget: Description

1.0 r3
-fixed error with color picker in new patch

1.0 r2
-fixed bug when more than one addon panel is created
Archived Files (12)
File Name
Version
Size
Author
Date
2.0 r12
26kB
Seerah
07/20/14 07:55 PM
2.0 r11
26kB
Seerah
07/19/14 02:49 PM
2.0 r10
25kB
Seerah
07/13/14 09:18 PM
2.0 r9
25kB
Seerah
07/05/14 06:55 PM
2.0 r8
25kB
Seerah
06/22/14 09:47 PM
2.0 r7
25kB
Seerah
06/15/14 05:17 PM
2.0 r6
25kB
Seerah
06/13/14 11:28 PM
2.0 r5
25kB
Seerah
06/12/14 10:32 PM
2.0 r4
25kB
Seerah
06/11/14 08:56 PM
2.0 r3
25kB
Seerah
06/11/14 07:49 PM
2.0 r2
24kB
Seerah
06/10/14 10:06 PM
1.0 r8
6kB
Seerah
05/24/14 10:01 PM


Post A Reply Comment Options
Old Today, 03:00 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Re: Re: Re: How to handle setting updates on close

Originally Posted by dvstans
Yep, I'd prefer to apply settings once without resorting to an "apply" button. I was guessing that there would be a way to hook into a close/hide event for the settings panel to trigger the re-initialization of the module. Applying in real-time works, but it seems that it may lead to unresponsiveness with, say, slider controls (I'm assuming your lib calls the setval function as it's moving?)
Yes, the setFunc function is called as the slider updates. I'm not certain what you expect to become unresponsive or are trying to avoid though.
Seerah is offline Report comment to moderator  
Reply With Quote
Old Yesterday, 09:01 PM  
dvstans

Forum posts: 0
File comments: 2
Uploads: 0
Re: Re: How to handle setting updates on close

Originally Posted by Seerah
Originally Posted by dvstans
re-inits
who-what-now?

Are you talking about when your settings actually take place and the set function is called? If you want all of the settings to be applied at once then you would create an "Apply" button for your config. Otherwise, most everyone has their settings take effect in real-time.
Yep, I'd prefer to apply settings once without resorting to an "apply" button. I was guessing that there would be a way to hook into a close/hide event for the settings panel to trigger the re-initialization of the module. Applying in real-time works, but it seems that it may lead to unresponsiveness with, say, slider controls (I'm assuming your lib calls the setval function as it's moving?)
dvstans is offline Report comment to moderator  
Reply With Quote
Old Yesterday, 07:32 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Re: How to handle setting updates on close

Originally Posted by dvstans
re-inits
who-what-now?

Are you talking about when your settings actually take place and the set function is called? If you want all of the settings to be applied at once then you would create an "Apply" button for your config. Otherwise, most everyone has their settings take effect in real-time.
Seerah is offline Report comment to moderator  
Reply With Quote
Old 07/22/14, 09:51 PM  
dvstans

Forum posts: 0
File comments: 2
Uploads: 0
Question How to handle setting updates on close

Hi, very new to ESOUI and Lua, but have managed to get my add-on working with LibAddOnMenu2 (cool stuff!). I'm wondering if there's an easy way to handle re-inits once - only when the settings page is closed. I have it working now where updates are triggered each time an individual setting is changed, but this is very tedious to code, and all I need is a one-time re-init. I could also add an "apply" button, but that's far from ideal.

Thanks!
dvstans is offline Report comment to moderator  
Reply With Quote
Old 07/19/14, 02:50 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Originally Posted by merlight
Originally Posted by Seerah
You can already add anything you want to the controlData table. It's just a table. But I can add a table to each panel that contains all of the children. This might be useful since there is no real control:GetChildren() method.
Now that I think of it, it would probably be best to just have controlsToRefresh filled unconditionally. So that you don't end up with two tables containing the same. Not sure whether name-keyed table of children would be useful. I'll probably be better off with for i, ctl in ipairs(ctls) do ctl.data.onShow(ctl) end.
Current changelog
2.0 r11
- don't overwrite widgets list if table already exists (in case an external lib or addon registers a new widget type)
- headers, descriptions, submenus and custom widgets now have the ability to update their text when the panel and other controls refresh (simply change the name/text in the controlData table)
- custom controls now have the ability to refresh with other controls and your panel - there is a new optional field in the data table called refreshFunc (when the panel refreshes, this function will be called)
Seerah is offline Report comment to moderator  
Reply With Quote
Old 07/18/14, 06:55 AM  
merlight

Forum posts: 41
File comments: 8
Uploads: 0
Originally Posted by Seerah
You can already add anything you want to the controlData table. It's just a table. But I can add a table to each panel that contains all of the children. This might be useful since there is no real control:GetChildren() method.
Now that I think of it, it would probably be best to just have controlsToRefresh filled unconditionally. So that you don't end up with two tables containing the same. Not sure whether name-keyed table of children would be useful. I'll probably be better off with for i, ctl in ipairs(ctls) do ctl.data.onShow(ctl) end.
merlight is offline Report comment to moderator  
Reply With Quote
Old 07/17/14, 09:05 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Originally Posted by merlight
  1. optionData.reference - I named the checkboxes and hooked after panel "OnShow", so everytime the panel is shown, I update labels. Simple, I only hate there're globals just because of this. Could you add "panelReference/localReference/controlKey" whatever you name it to optionData, and a table to the panel so that the controls are accessible as panel.controls[optionData.controlKey]?
You can already add anything you want to the controlData table. It's just a table. But I can add a table to each panel that contains all of the children. This might be useful since there is no real control:GetChildren() method.
Seerah is offline Report comment to moderator  
Reply With Quote
Old 07/17/14, 02:19 AM  
merlight

Forum posts: 41
File comments: 8
Uploads: 0
Hi. I have a few questions which might be feature requests, but I'm not sure if I'm not just missing anything. My starting point is this: I want an option to be applicable per-guild. For example 5 checkboxes labelled by guild name. Problem is when I join/leave a guild, I need to update the labels (without /relouadui), but could not find a painless way to do that - the "disabled" attribute works great; I was hoping for some kind of "onShow". I've come up with two possible solutions, none of which I quite like I'll start with the one I'm using currently:
  1. optionData.reference - I named the checkboxes and hooked after panel "OnShow", so everytime the panel is shown, I update labels. Simple, I only hate there're globals just because of this. Could you add "panelReference/localReference/controlKey" whatever you name it to optionData, and a table to the panel so that the controls are accessible as panel.controls[optionData.controlKey]?
    .
  2. panel.registerForRefresh - before writing the simplest, I was thinking about using this. If I enabled registerForRefresh during control creation, they'd be inserted into panel.controlsToRefresh, and I would then use this list in my "OnShow" handler. After dismissing the idea (due to the hackery with the flag I don't need but would need to enable just to have the list filled), I started thinking about the feature a bit. Although I only have 5 controls, there might be 30, and perhaps only a handful of them would require others to refresh. It is very well possible to implement per-option refresh even now, by disabling registerForRefresh after control creation, and firing "LAM-RefreshPanel" in setFunc; but I don't find that convenient. How about using setFunc result as a callback-to-fire? (it would require controls to be inserted in controlsToRefresh unconditionally)
    Lua Code:
    1. local result = control.data.setFunc(value)
    2. --after setting this value, let's refresh the others to see if any should be disabled or have their settings changed
    3. if type(result) == "string" then -- if setFunc returns a string, fire that and no other callback
    4.     cm:FireCallbacks(result, control)
    5. elseif control.panel.data.registerForRefresh then
    6.     cm:FireCallbacks("LAM-RefreshPanel", control)
    7. end
merlight is offline Report comment to moderator  
Reply With Quote
Old 07/13/14, 08:43 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Sorry, CDG - not sure how I missed it. >< All fixed now.

Originally Posted by CrazyDutchGuy
While i am at it, is it possible to alter the colorpicker (add an option) so that it does not show the alpha channel.
Don't pass an alpha value to the color picker in your getFunc.
Seerah is offline Report comment to moderator  
Reply With Quote
Old 07/10/14, 02:20 PM  
farangkao
 
farangkao's Avatar
AddOn Author - Click to view AddOns

Forum posts: 50
File comments: 35
Uploads: 2
Tested on 1.3.0 with my Addon, LibAddonMenu works without problems.
__________________
@farangkao on EU Servers. My Addon: Mobile Bank Extended, For Developers: ZeroBrane Studio - ESOAddonDev Plugin
farangkao is online now Report comment to moderator  
Reply With Quote
Old 07/06/14, 03:01 AM  
CrazyDutchGuy
 
CrazyDutchGuy's Avatar
AddOn Author - Click to view AddOns

Forum posts: 72
File comments: 145
Uploads: 6
While i am at it, is it possible to alter the colorpicker (add an option) so that it does not show the alpha channel.
__________________
Addon Developer : ATLAS - Lost Treasure - Show Loot - Bank Stack - ATLAS Boss Logger
Addon Maintainer : Addon Clearer - Research Grid - Vampire Status - Awesome Info - Guild Chat - Sous Chef - Guild Bank Cycler - LibSort - Mr Plow
Donations : ingame @CrazyDutchGuy (EU) or on paypal
CrazyDutchGuy is offline Report comment to moderator  
Reply With Quote
Old 07/06/14, 02:58 AM  
CrazyDutchGuy
 
CrazyDutchGuy's Avatar
AddOn Author - Click to view AddOns

Forum posts: 72
File comments: 145
Uploads: 6
Still not fixed the following bug
http://www.esoui.com/portal.php?id=5...wbug&bugid=876

Also the alignment of the warning icons is not in line when you have a dropdown and a slider. I think the slider indents a bit more then the other controls.

Old
Lua Code:
  1. if warning then
  2.     control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
  3.     control.warning:SetAnchor(RIGHT, combobox, LEFT, -5, 0)
  4.     control.warning.tooltipText = warningText
  5. end
As it should be
Lua Code:
  1. if dropdownData.warning then
  2.     control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
  3.     control.warning:SetAnchor(RIGHT, combobox, LEFT, -5, 0)
  4.     control.warning.tooltipText = dropdownData.warningText
  5. end
__________________
Addon Developer : ATLAS - Lost Treasure - Show Loot - Bank Stack - ATLAS Boss Logger
Addon Maintainer : Addon Clearer - Research Grid - Vampire Status - Awesome Info - Guild Chat - Sous Chef - Guild Bank Cycler - LibSort - Mr Plow
Donations : ingame @CrazyDutchGuy (EU) or on paypal
CrazyDutchGuy is offline Report comment to moderator  
Reply With Quote
Old 07/05/14, 07:01 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 609
File comments: 102
Uploads: 1
Re: Sub Menu Close Method

Originally Posted by KorenoGamer
I was wondering is it would be possible to add something so you can close a sub menu from the bottom of the sub menu. Some sub menus are log enough so the top of it is off the screen when you scroll to the bottom of it. It is annoying to have to scroll back up to the top to close it.
In r9, there is a clickable strip at the bottom of a submenu which allows you to close it.
Seerah is offline Report comment to moderator  
Reply With Quote
Old 07/01/14, 08:41 AM  
KorenoGamer

Forum posts: 1
File comments: 51
Uploads: 0
Sub Menu Close Method

I was wondering is it would be possible to add something so you can close a sub menu from the bottom of the sub menu. Some sub menus are log enough so the top of it is off the screen when you scroll to the bottom of it. It is annoying to have to scroll back up to the top to close it.
KorenoGamer is offline Report comment to moderator  
Reply With Quote
Old 06/23/14, 03:57 PM  
amilious
 
amilious's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 51
Uploads: 2
Description

-
Last edited by amilious : 06/24/14 at 01:50 AM.
amilious is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.