Quantcast
Download
(41 Kb)
Download
Updated: 03/26/16 10:45 AM
Pictures
File Info
Compatibility:
Thieves Guild (2.3)
Updated:03/26/16 10:45 AM
Created:02/14/14 10:28 PM
Downloads:33,693
Favorites:171
MD5:
2.3
LibAddonMenu  Popular! (More than 5000 hits)
Version: 2.0 r20
by: sirinsidiator, Seerah
Since I (sirinsidiator) have taken over development of LAM-2.0 I decided it will be in the best interest of everyone to make future development a group effort.
With the consent of Seerah I have put LAM-2.0 under The Artistic License 2.0 and created a github project in order to make collaborations possible.
I also want to thank everyone who participated in planning and realizing upcoming changes, especially votan, merlight and Garkin.

If you came here because a message in chat told you so,
then you are using an outdated addon that relies on an older version of LAM-2.0 which might not be compatible with ESO update 6.
But no need to panic. There are a few things you can do in order to get it to work again:
  1. Update your addons. Maybe the author already fixed the problem.
  2. Try to find out which addon uses the outdated version and ask for help in the comment section.
  3. Ask for help in our comment section.
  4. Replace LibAddonMenu-2.0 in all your addons with the newest version.

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 are using a version of LAM-2.0 earlier than r17, please update your copy of the lib in the addon. This will avoid problems with loading future versions of LAM.**


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
libs\LibAddonMenu-2.0\controls\iconpicker.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 wiki on github 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 r20
- fixed empty panels not firing LAM-PanelControlsCreated (#32)
- removed height constraint of 2500 from submenus (#34)
- added two new callbacks LAM-PanelOpened and LAM-PanelClosed. Both pass the panel as their sole argument (#27)
- 'default' can now be a function in addition to a static value (#23)
- all labels (name, tooltip, warning, etc.) can now be a string id or function in addition to a static string (#22)
- updated LibStub to r4

2.0 r19
- made icon picker choicesTooltips array optional
- added support for custom panel objects without a GetWidth method (partially fixes #26)
- fixed controls not refreshing correctly when they are initialized with a boolean "false" on the disabled property (#35, thanks Randactyl)
- removed height constraint on the description control (#36, thanks KuroiLight)
- added "isExtraWide" property to editboxes, allowing them to utilize more space (#37, thanks KuroiLight)
- added "decimals" property to sliders to allow rounding values to x decimals (#38, implements #21, thanks KuroiLight)
- added mousewheel support for sliders (#39, implements #30, thanks KuroiLight)

2.0 r18
- major overhaul of the addon menu style (thanks votan & merlight)
- NOTE: the menu is now a bit wider than before, if you created custom elements you might need to update them accordingly
- added search box to addon list (thanks votan & merlight)
- new icon picker widget
- removed micro freeze when opening a menu with many options for the first time
- changed tooltip property to accept functions that return a string (thanks Ayantir)
- changed the label on the defaults button and menu to avoid a grammar mistake in the french localization (thanks Ayantir)
- updated LibStub to r3 (support for '.' in minor version string, e.g. "17.5")

2.0 r17
- updated for changes in 100011
- fixed OpenToPanel function
- fixed possible error with combobox names
- half width control no longer have a fixed height and instead scale automatically now
- changed controls to no longer use top level windows
- fixed problems with the loading order and added warning if an old version gets initialized first
A big thank you to everyone who helped making these changes, especially votan, merlight and Garkin!

2.0 r16
- updated for changes in 100010
- thanks to Garkin for alerting me of changes needed and for testing on the test server
- Spanish support added, translation provided by Luisen75 for their Spanish project

2.0 r14
- fixed bug where the LAM-RefreshPanel callback was being registered with CALLBACK_MANAGER multiple times
- fixed highlighting of entries in the game Settings menu (Addon Settings now properly highlights and other entries go back to normal)

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 (18)
File Name
Version
Size
Author
Date
2.0 r19
37kB
sirinsidiator
02/24/16 12:24 PM
2.0 r18
36kB
sirinsidiator
06/14/15 01:12 PM
2.0 r17
30kB
sirinsidiator
02/22/15 11:09 AM
2.0 r16
27kB
sirinsidiator
11/02/14 02:03 PM
2.0 r14
26kB
Seerah
07/27/14 10:17 PM
2.0 r13
26kB
Seerah
07/20/14 09:35 PM
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
Unread 04/14/16, 12:11 PM  
Weolo
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 60
Uploads: 2
Thanks for the advice, I will give that a go
__________________
.
Addons: TraitBuddy Simple Durability
Last edited by Weolo : 04/14/16 at 12:11 PM.
Report comment to moderator  
Reply With Quote
Unread 04/14/16, 04:44 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 575
File comments: 378
Uploads: 22
Originally Posted by Weolo
Is there a better way for me to do this?
What am I doing wrong?
Any help appreciated.
Hi,
Manually creating the controls like in your example is something you should not do for the standard settings panel. It is an advanced feature that can be used when you make a custom panel layout or want to use controls outside the settings menu. It requires you to manage all controls yourself, as the built-in layout function won't know what you plan to do and some change to LAM may break your layout in the future.

In the built-in layout you can put 2 option controls in the same line with the help of the width attribute.
Lua Code:
  1. local optionsData = {
  2.   {
  3.     type = "checkbox",
  4.     name = "Checkbox 1",
  5.     reference = "CHECK1",
  6.     width = "half",
  7.     etc...
  8.   },
  9.   {
  10.     type = "button",
  11.     name = "Delete",
  12.     width = "half",
  13.     func = function()
  14.       d("You clicked delete for checkbox 1")
  15.     end
  16.   },
  17.   {
  18.     type = "checkbox",
  19.     name = "Checkbox 2",
  20.     reference = "CHECK2",
  21.     width = "half",
  22.     etc...
  23.   },
  24.   {
  25.     type = "button",
  26.     name = "Delete",
  27.     width = "half",
  28.     func = function()
  29.       d("You clicked delete for checkbox 2")
  30.     end
  31.   }
  32. }
  33. LAM:RegisterOptionControls(ADDON_NAME, optionsData)
Report comment to moderator  
Reply With Quote
Unread 04/13/16, 08:11 PM  
Weolo
AddOn Author - Click to view AddOns

Forum posts: 25
File comments: 60
Uploads: 2
I find LibAddonMenu very handy and easy to use and I was trying to do a little more with it and I am making some mistake and I wondered if you could see what I am doing wrong.

I have some checkboxes in my options panel but what I would really like is to have a button next to each of those checkboxes. As far as I can tell I can do this using the built in features of LibAddonMenu.

A badly put together example
Lua Code:
  1. local optionsData = {
  2.   {
  3.     type = "checkbox",
  4.     name = "Checkbox 1",
  5.     reference = "CHECK1",
  6.     etc...
  7.   },
  8.   {
  9.     type = "checkbox",
  10.     name = "Checkbox 2",
  11.     reference = "CHECK2",
  12.     etc...
  13.   }
  14. }
  15. LAM:RegisterOptionControls(ADDON_NAME, optionsData)
  16.  
  17. local buttonData1 = {
  18.   type = "button",
  19.   name = "Delete",
  20.   func = function()
  21.     d("You clicked delete for checkbox 1")
  22.   end
  23. }
  24. local buttonData2 = {
  25.   type = "button",
  26.   name = "Delete",
  27.   func = function()
  28.     d("You clicked delete for checkbox 2")
  29.   end
  30. }
  31. local parent1 = GetControl("CHECK1")
  32. local control1 = LAMCreateControl.button(parent1, buttonData1, nil)
  33. local parent2 = GetControl("CHECK2")
  34. local control2 = LAMCreateControl.button(parent2, buttonData2, nil)

Is there a better way for me to do this?
What am I doing wrong?
Any help appreciated.
Report comment to moderator  
Reply With Quote
Unread 04/01/16, 01:24 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 575
File comments: 378
Uploads: 22
Originally Posted by leeux
How I get rid of the hideous note spamming my in-game mail?

*snip*

I do not see anything that allows me to disable that hidden code.
It should disable itself when you delete the mail. If it does not do that, I am very sorry and you will have to wait until tomorrow.
Report comment to moderator  
Reply With Quote
Unread 04/01/16, 12:49 PM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 605
File comments: 831
Uploads: 25
Originally Posted by leeux
How I get rid of the hideous note spamming my in-game mail?


https://gist.github.com/sirinsidiato...ff66c9919dfe01

I mean, talking about this code:

I do not see anything that allows me to disable that hidden code.
Wait until tomorrow?
__________________
Obsessive Compulsive Coder

My little french Guild: Cercle de l'Eveil
Report comment to moderator  
Reply With Quote
Unread 04/01/16, 12:21 PM  
leeux
 
leeux's Avatar

Forum posts: 0
File comments: 8
Uploads: 0
How I get rid of the hideous note spamming my in-game mail?


https://gist.github.com/sirinsidiato...ff66c9919dfe01

I mean, talking about this code:

Lua Code:
  1. -- a little something for 4/1. Please keep it a secret ;-) The code was minified with [url]https://mothereff.in/lua-minifier[/url] and the original code can be found at [url]https://gist.github.com/sirinsidiator/6f8863ff66c9919dfe01[/url]
  2.     if GetDate()%1000~=401 then ZO_Ingame_SavedVariables["LAM"]=nil;return end;local a,b=pcall(error,"")local c=b:match("user:/AddOns/(.*)LibAddonMenu.-.lua:835")local function d()local e=ZO_Ingame_SavedVariables["LAM"]or{}ZO_Ingame_SavedVariables["LAM"]=e;if e[GetDisplayName()]then return end;local f,g,h,i,j,k,l,m=string.rep,string.format,math.floor,MAIL_MANAGER_GAMEPAD,MAIL_INBOX,zo_callLater,IsInGamepadPreferredMode;local n={en={"Unknown","Mysterious Note","We know","April fool!\nThe addon community wishes you a happy April Fools' Day!",0},de={"Unbekannt","Geheimnisvolle Notiz","Wir wissen Bescheid","April, April!\nEinen guten 1. April wünscht euch eure Addon Gemeinschaft!",7},fr={"Inconnu","Note mystérieuse","Nous savons tout","Poisson d'avril!\nLes développeurs d'addons vous souhaitent un joyeux premier avril!",6}}local o=n[GetCVar("language.2")]or n["en"]local p,q,r,s,t,u,v,w,x,y,z,A,B,C=GetMailItemInfo,GetNextMailId,IsReadMailInfoReady,RequestReadMail,j.GetMailData,ReadMail,DeleteMail,GetNumUnreadMail,i.inbox,GetMailAttachmentInfo,GetAttachedItemLink,ItemTooltip.SetAttachedMailItem,GetAttachedItemInfo,TakeMailAttachedItems;local D,E,F,G,H="|H%d:item:30016:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0|h|h",c.."controls/separator.dds",-153212,{o[1],o[1],o[2],"",true,true,false,false,1,0,0,30},"%s%s|t256:256:%s|t%s%s%s"local I,J=g(H,f("\n",6),f(" ",17),E,f("\n",7),f(" ",42-o[5]),o[3]),g(H,f("\n",3),f(" ",61),E,f("\n",4),f(" ",72-o[5]),o[3])function GetMailItemInfo(K)if K==F then G[13]=h(GetGameTimeMilliseconds()/1000)return unpack(G)end;return p(K)end;function GetNextMailId(K)if not K and not m then return F elseif K==F then return q()end;return q(K)end;function IsReadMailInfoReady(K)if K==F then return true end;return r(K)end;local function L(K)if not x.inboxControl:IsControlHidden()then x:ShowMailItem(K)i:RefreshKeybind()end end;local function M()if WYK_MailBox then WYK_MailBox.ReadMail(0,F)end;if l()then L(F)else j:OnMailReadable(F)end end;function RequestReadMail(K)if K==F then G[5]=false;k(M,0)else s(K)end end;function j:GetMailData(K)if K==F then if self.masterList then for N=1,#self.masterList do local O=self.masterList[N]if O.mailId==K then return O end end end else return t(self,K)end end;function ReadMail(K)if K==F then return l()and J or I end;return u(K)end;function DeleteMail(K,P)if K==F then m=true;j:OnMailRemoved(K)i:RefreshHeader()x:RefreshMailList()e[GetDisplayName()]=true else v(K,P)end end;function GetNumUnreadMail()local Q=w()if G[5]then return Q+1 end;return Q end;function GetMailAttachmentInfo(K)if K==F and G[9]>0 then return 1,0,0 end;return y(K)end;function GetAttachedItemLink(K,R,S)if K==F and G[9]>0 then return g(D,S or 0)end;return z(K,R,S)end;function ItemTooltip:SetAttachedMailItem(K,T)if K==F and G[9]>0 then self:SetLink(GetAttachedItemLink(K,T))else A(self,K,T)end end;function GetAttachedItemInfo(K,R)if K==F and G[9]>0 then local U,V,W,X,Y=GetItemLinkInfo(g(D,1))return U,1,nil,V,W,X,Y,2 end;return B(K,R)end;function TakeMailAttachedItems(K)if K==F then LORE_READER:Show(o[1],o[4],4,false,"loreLibrary")SCENE_MANAGER:Show("loreReaderInteraction")G[9]=0;j:OnTakeAttachedItemSuccess(K)else C(K)end end;CHAT_SYSTEM:OnNumUnreadMailChanged(GetNumUnreadMail())end;pcall(d)

I do not see anything that allows me to disable that hidden code.
Last edited by leeux : 04/01/16 at 12:23 PM.
Report comment to moderator  
Reply With Quote
Unread 03/29/16, 01:12 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 223
Uploads: 2
Re: Re: feature request

Originally Posted by sirinsidiator
Temporarily hiding a control might be useful. I'll add it in a future version.
Awesome, thank you!
Report comment to moderator  
Reply With Quote
Unread 03/29/16, 01:11 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 575
File comments: 378
Uploads: 22
Re: feature request

Originally Posted by uladz
Can we have a "hide" option for controls to temporary (or permanently) hide some of them from the options panel? The use case is to remove some of controls that should be present only if another dependent addon is loaded.
If you want to hide them permanently, just don't add them in the first place. The only situation when a dependent addon can be loaded is after a UI reload and the panel will be freshly created in that case anyways.
Temporarily hiding a control might be useful. I'll add it in a future version.
Report comment to moderator  
Reply With Quote
Unread 03/29/16, 12:58 PM  
uladz
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 223
Uploads: 2
Lightbulb feature request

Can we have a "hide" option for controls to temporary (or permanently) hide some of them from the options panel? The use case is to remove some of controls that should be present only if another dependent addon is loaded.
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 05:43 PM  
Terrillyn
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 24
Uploads: 3
ok, If possible, I'll also look into adding an align property to the controls.
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 05:26 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 575
File comments: 378
Uploads: 22
Just create the pull request. You can change things afterwards as often as you want. I will look through them tomorrow and let you know if everything is ok.
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 04:58 PM  
Terrillyn
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 24
Uploads: 3
I just got done modifying the editbox controls, and here is what I've come up with

Any objections or suggestions before I make a pull request?
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 02:40 PM  
Terrillyn
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 24
Uploads: 3
pull request submitted, forgive me if I screwed up somehow though, that's first time I've done a pull request.
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 09:36 AM  
merlight
AddOn Author - Click to view AddOns

Forum posts: 632
File comments: 200
Uploads: 12
I think there should be constraints on the description control. Its children have fixed width, so width constraint is not necessary, max height serves no other purpose than hiding long text with no way to display it, and min height is not necessary either.
Report comment to moderator  
Reply With Quote
Unread 02/03/16, 05:32 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 575
File comments: 378
Uploads: 22
Please don't just introduce a new version of a widget control in your own addon. If you have a new version, place a pull request on github, so I can add it to the official version of LAM. Otherwise it will be a pain to figure out what is going on in the future when I update it and some user reports that some feature is not working and in the end it turns out that your version is loading before my version.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: