Quantcast
Download
(42 Kb)
Download
Updated: 10/30/16 10:00 AM
Pictures
File Info
Compatibility:
One Tamriel (2.6)
Updated:10/30/16 10:00 AM
Created:02/14/14 10:28 PM
Monthly downloads:1,470
Total downloads:43,894
Favorites:192
MD5:
2.6
LibAddonMenu  Popular! (More than 5000 hits)
Version: 2.0 r23
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
libs\LibAddonMenu-2.0\controls\divider.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 r23
- added Chinese translation (#64, thanks bssthu)
- added tooltips for dropdown menu entries (#42)
- added support for separate values for dropdown menu entries (#65)
- added keybind for reset to defaults button (#68)
- added requireReload property for input controls (#47)
- fixed support for nested submenus (#61, thanks Baertram)
- fixed alpha and height not working on divider control (#69)

2.0 r22
- fixed mouse exit events for sliders and textures (#52, thanks silvereyes333)
- fixed decimal input on sliders (#54)
- fixed icon picker not retaining color when disabled is toggled (#58)
- fixed slider accepting mouse wheel input while being disabled (#60)
- added support for nested submenus (#53)
- added new divider widget (#56, thanks silvereyes333)
- added new function "UpdateWarning" to controls which allows to refresh the warning text (#55, thanks silvereyes333)
- added new property "website" to panels which will render a button in the panel to open the specified addon URL (#57)
- updated localization (#59, thanks everyone who helped with it)

2.0 r21
- fixed panel creation starting more than once when switching between different addon panels quickly (#40)
- fixed LAM.util getting wiped with each version load causing errors for many players (#44)
- fixed disabled controls not having the correct label color in some cases (#41)
- fixed controls not updating their own disabled state when their value changes (#51)
- added Japanese translation (thanks k0ta0uchi) (#45)
- added isDangerous flag for button controls (#50)
- when set to true it changes the text color of the button to red and opens a dialog which shows the label and the warning text before running the callback
- added new options for sliders and fixed some bugs (#49)
- autoSelect (boolean): when set to true it makes the input field select all text when it gains focus
- inputLocation (string): setting it to "right" will move the input field to the right side of the slider and make it slightly bigger. For aesthetic reasons this should only be used in custom panels and not in the addon menu
- clampInput (boolean): true by default and if set to false it allows the input values of the slider to exceed the min and max value
- for other internal code changes take a look at the git history

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 (21)
File Name
Version
Size
Author
Date
2.0 r22
39kB
sirinsidiator
08/06/16 07:42 AM
2.0 r21
38kB
sirinsidiator
07/17/16 11:04 AM
2.0 r20
41kB
sirinsidiator
03/26/16 10:45 AM
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 11/22/16, 04:08 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 740
File comments: 471
Uploads: 24
Re: dropdowns and choicesValues

Originally Posted by tomtomhotep
I think it's great that you added the choicesValues field to the dropdown data table!

One thing, tho. false is a perfectly valid and common value for a variable, but you don't support the (boolean) false as a value in the choicesValues table.

I think you should fix this. I believe you only need to make 3 changes in dropdown.lua:

One, in function UpdateChoices, change:

Lua Code:
  1. for i = 1, #choices do
  2.         local entry = control.dropdown:CreateItemEntry(choices[i], DropdownCallback)
  3.         entry.control = control
  4.         if choicesValues then
  5.             entry.value = choicesValues[i]
  6.         end
  7.         control.choices[entry.value or entry.name] = entry.name
  8.         control.dropdown:AddItem(entry, not control.data.sort and ZO_COMBOBOX_SUPRESS_UPDATE)
  9.     end

to:

Lua Code:
  1. for i = 1, #choices do
  2.         local entry = control.dropdown:CreateItemEntry(choices[i], DropdownCallback)
  3.         entry.control = control
  4.         local value = entry.name
  5.         if choicesValues then
  6.             entry.value = choicesValues[i]   -- this can't be nil, can it?
  7.             value = entry.value
  8.         end
  9.         control.choices[value] = entry.name
  10.         control.dropdown:AddItem(entry, not control.data.sort and ZO_COMBOBOX_SUPRESS_UPDATE)
  11.     end



Two, change:

Lua Code:
  1. local function DropdownCallback(control, choiceText, choice)
  2.     choice.control:UpdateValue(false, choice.value or choiceText)
  3. end

to:

Lua Code:
  1. local function DropdownCallback(control, choiceText, choice)
  2.     local value = choiceText
  3.     if (choice.value ~= nil) then value = choice.value end
  4.     choice.control:UpdateValue(false, value)
  5. end


Three, in function UpdateValue change:

Lua Code:
  1. elseif value then

to:

Lua Code:
  1. elseif (value ~= nil) then


Of course, i didn't make these mods on my copy, I just used a simple work-around in my getFunc and setFunc.
Hey. I didn't think anyone would use the dropdown for boolean values as these are covered by checkboxes. xD
Still, I can add your changes. If you have a github account, feel free to open a ticket, otherwise I'll do it myself when I start collecting info for the next update.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 11/21/16, 05:07 PM  
tomtomhotep
 
tomtomhotep's Avatar
AddOn Author - Click to view AddOns

Forum posts: 4
File comments: 22
Uploads: 2
dropdowns and choicesValues

I think it's great that you added the choicesValues field to the dropdown data table!

One thing, tho. false is a perfectly valid and common value for a variable, but you don't support the (boolean) false as a value in the choicesValues table.

I think you should fix this. I believe you only need to make 3 changes in dropdown.lua:

One, in function UpdateChoices, change:

Lua Code:
  1. for i = 1, #choices do
  2.         local entry = control.dropdown:CreateItemEntry(choices[i], DropdownCallback)
  3.         entry.control = control
  4.         if choicesValues then
  5.             entry.value = choicesValues[i]
  6.         end
  7.         control.choices[entry.value or entry.name] = entry.name
  8.         control.dropdown:AddItem(entry, not control.data.sort and ZO_COMBOBOX_SUPRESS_UPDATE)
  9.     end

to:

Lua Code:
  1. for i = 1, #choices do
  2.         local entry = control.dropdown:CreateItemEntry(choices[i], DropdownCallback)
  3.         entry.control = control
  4.         local value = entry.name
  5.         if choicesValues then
  6.             entry.value = choicesValues[i]   -- this can't be nil, can it?
  7.             value = entry.value
  8.         end
  9.         control.choices[value] = entry.name
  10.         control.dropdown:AddItem(entry, not control.data.sort and ZO_COMBOBOX_SUPRESS_UPDATE)
  11.     end



Two, change:

Lua Code:
  1. local function DropdownCallback(control, choiceText, choice)
  2.     choice.control:UpdateValue(false, choice.value or choiceText)
  3. end

to:

Lua Code:
  1. local function DropdownCallback(control, choiceText, choice)
  2.     local value = choiceText
  3.     if (choice.value ~= nil) then value = choice.value end
  4.     choice.control:UpdateValue(false, value)
  5. end


Three, in function UpdateValue change:

Lua Code:
  1. elseif value then

to:

Lua Code:
  1. elseif (value ~= nil) then


Of course, i didn't make these mods on my copy, I just used a simple work-around in my getFunc and setFunc.
Report comment to moderator  
Reply With Quote
Unread 11/05/16, 11:08 AM  
Geraintmawr

Forum posts: 2
File comments: 44
Uploads: 0
Re: Re: Constant Catchup

I am honestly not sure how this is in any way related to LibAddonMenu. It would probably be better if you made a post in the general authoring section about this topic.
The update message for addons is not from ZOS btw. It is generated by a library which is bundled in some popular addons, because many users report issues that have been fixed for a long time instead of updating their addons first.

Thanks for the response!

I'm not sure either! If I had been awake then Lib Addon >>>> Menu <<<< would have been a dead giveaway!!! XD

Interesting point about the update thing and a valid reminder whoever it comes from.

I'll take your advice on the use of the proper forum!
Report comment to moderator  
Reply With Quote
Unread 11/04/16, 06:20 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 740
File comments: 471
Uploads: 24
Re: Constant Catchup

Originally Posted by Geraintmawr
Why do you guys have to constantly update your addons to keep up with ZOS' moving goal posts?

In the bad old days of the 1970s, when I was a young COBOL programmer, there was a central module in every suite of programs, that sat above all the others. It was the font of all knowledge and sequencing for the rest of the suite.

Is there some way that we could all (players and authors) have a similar, single, over arching API addon that one person updates and all addons access?

In that way I would not be getting ig messages from ZOS suggesting that I update my addons, when I do so religiously (thank Stendarr) as soon as minion tells me there is an update available.

Is this what you are talking about here?
Or have I missed the point?
I am honestly not sure how this is in any way related to LibAddonMenu. It would probably be better if you made a post in the general authoring section about this topic.
The update message for addons is not from ZOS btw. It is generated by a library which is bundled in some popular addons, because many users report issues that have been fixed for a long time instead of updating their addons first.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 11/04/16, 06:08 AM  
Geraintmawr

Forum posts: 2
File comments: 44
Uploads: 0
Constant Catchup

Why do you guys have to constantly update your addons to keep up with ZOS' moving goal posts?

In the bad old days of the 1970s, when I was a young COBOL programmer, there was a central module in every suite of programs, that sat above all the others. It was the font of all knowledge and sequencing for the rest of the suite.

Is there some way that we could all (players and authors) have a similar, single, over arching API addon that one person updates and all addons access?

In that way I would not be getting ig messages from ZOS suggesting that I update my addons, when I do so religiously (thank Stendarr) as soon as minion tells me there is an update available.

Is this what you are talking about here?
Or have I missed the point?
Report comment to moderator  
Reply With Quote
Unread 10/30/16, 12:29 PM  
Baertram
 
Baertram's Avatar
AddOn Author - Click to view AddOns

Forum posts: 946
File comments: 876
Uploads: 38
Many many thanks for all the work you put into this library and it's docs sirinsidiator!
Last edited by Baertram : 10/30/16 at 12:29 PM.
Report comment to moderator  
Reply With Quote
Unread 10/15/16, 03:32 AM  
Carter_DC
 
Carter_DC's Avatar
AddOn Author - Click to view AddOns

Forum posts: 12
File comments: 12
Uploads: 4
Amazing piece of work !
Great Job !
Report comment to moderator  
Reply With Quote
Unread 07/11/16, 12:47 PM  
Enodoc
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 49
Uploads: 2
Re: Re: Re: Re: Disable a button

Originally Posted by sirinsidiator
Originally Posted by Enodoc
Originally Posted by sirinsidiator
You can manually refresh your panel by calling
Lua Code:
  1. CALLBACK_MANAGER:FireCallbacks("LAM-RefreshPanel", panel)
where panel is the return value from RegisterAddonPanel, but in your case it should not be necessary. As long as you have the registerForRefresh flag enabled in your panel it should refresh itself when necessary.
Great, thanks! registerForRefresh is enabled, but clicking a button doesn't seem to trigger a refresh, so firing that callback is likely what I need. Thanks again!
That's strange. The button itself already fires the callback when you click it:
Lua Code:
  1. button:SetHandler("OnClicked", function(self, ...)
  2.         buttonData.func(self, ...)
  3.         if control.panel.data.registerForRefresh then
  4.             cm:FireCallbacks("LAM-RefreshPanel", control)
  5.         end
  6.     end)
Agreed, it's a bit odd. Putting the callback in worked though, so thanks for that!
__________________
ESOTU Community Ambassador

UESP: The Unofficial Elder Scrolls Pages - A collaborative source for all knowledge on the Elder Scrolls series since 1995
Report comment to moderator  
Reply With Quote
Unread 07/11/16, 04:58 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 740
File comments: 471
Uploads: 24
Re: Re: Re: Disable a button

Originally Posted by Enodoc
Originally Posted by sirinsidiator
You can manually refresh your panel by calling
Lua Code:
  1. CALLBACK_MANAGER:FireCallbacks("LAM-RefreshPanel", panel)
where panel is the return value from RegisterAddonPanel, but in your case it should not be necessary. As long as you have the registerForRefresh flag enabled in your panel it should refresh itself when necessary.
Great, thanks! registerForRefresh is enabled, but clicking a button doesn't seem to trigger a refresh, so firing that callback is likely what I need. Thanks again!
That's strange. The button itself already fires the callback when you click it:
Lua Code:
  1. button:SetHandler("OnClicked", function(self, ...)
  2.         buttonData.func(self, ...)
  3.         if control.panel.data.registerForRefresh then
  4.             cm:FireCallbacks("LAM-RefreshPanel", control)
  5.         end
  6.     end)
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 07/11/16, 03:27 AM  
Enodoc
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 49
Uploads: 2
Re: Re: Disable a button

Originally Posted by sirinsidiator
You can manually refresh your panel by calling
Lua Code:
  1. CALLBACK_MANAGER:FireCallbacks("LAM-RefreshPanel", panel)
where panel is the return value from RegisterAddonPanel, but in your case it should not be necessary. As long as you have the registerForRefresh flag enabled in your panel it should refresh itself when necessary.
Great, thanks! registerForRefresh is enabled, but clicking a button doesn't seem to trigger a refresh, so firing that callback is likely what I need. Thanks again!
__________________
ESOTU Community Ambassador

UESP: The Unofficial Elder Scrolls Pages - A collaborative source for all knowledge on the Elder Scrolls series since 1995
Report comment to moderator  
Reply With Quote
Unread 07/10/16, 12:47 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 740
File comments: 471
Uploads: 24
Re: Disable a button

Originally Posted by Enodoc
Is there an easy way to get a "button" to refresh the panel when clicked?

Lua Code:
  1. {
  2.             type = "button",
  3.             name = GetString(BUTTON_NAME),
  4.             tooltip = GetString(BUTTON_TOOLTIP),
  5.             func = function() ButtonBool = true end,
  6.             disabled = function() return (ButtonBool == true) end,
  7.             width = "half",
  8.         },
The button is being used as an enabler for subsequent controls, through those having
Lua Code:
  1. disabled = function() return not ButtonBool end,
and the button itself shouldn't be clickable again.

It refreshes when a "checkbox" is toggled, or if you click to another add-on and back, but it would be good if there was something I could call in the button function that would cause it to refresh itself. Thanks!
You can manually refresh your panel by calling
Lua Code:
  1. CALLBACK_MANAGER:FireCallbacks("LAM-RefreshPanel", panel)
where panel is the return value from RegisterAddonPanel, but in your case it should not be necessary. As long as you have the registerForRefresh flag enabled in your panel it should refresh itself when necessary.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Last edited by sirinsidiator : 07/10/16 at 12:51 PM.
Report comment to moderator  
Reply With Quote
Unread 07/09/16, 03:47 PM  
Enodoc
AddOn Author - Click to view AddOns

Forum posts: 24
File comments: 49
Uploads: 2
Disable a button

Is there an easy way to get a "button" to refresh the panel when clicked?

Lua Code:
  1. {
  2.             type = "button",
  3.             name = GetString(BUTTON_NAME),
  4.             tooltip = GetString(BUTTON_TOOLTIP),
  5.             func = function() ButtonBool = true end,
  6.             disabled = function() return (ButtonBool == true) end,
  7.             width = "half",
  8.         },
The button is being used as an enabler for subsequent controls, through those having
Lua Code:
  1. disabled = function() return not ButtonBool end,
and the button itself shouldn't be clickable again.

It refreshes when a "checkbox" is toggled, or if you click to another add-on and back, but it would be good if there was something I could call in the button function that would cause it to refresh itself. Thanks!
__________________
ESOTU Community Ambassador

UESP: The Unofficial Elder Scrolls Pages - A collaborative source for all knowledge on the Elder Scrolls series since 1995
Last edited by Enodoc : 07/09/16 at 04:00 PM.
Report comment to moderator  
Reply With Quote
Unread 06/20/16, 11:19 AM  
Sasky
AddOn Author - Click to view AddOns

Forum posts: 241
File comments: 89
Uploads: 4
Originally Posted by votan
Originally Posted by merlight
1) if there is no other add-on with properly released LAM, the user will end up with no LAM at all
I don't think, that would be wrong. If the addon, embedding an unreleased github version, is the only one using LAM2, causing an error is correct in my opinion.
Maybe the check should cause the Lua error dialog?
Sorry about that. Fixing it now that I'm back from travel. However, I'm not sure this doesn't point to an underlying issue, since the Git difference when I forced it to the released r20 version had
  1. The version number at 20
  2. An April Fools snippit added
  3. A DDS used by that snippet added
I'm not sure what in there would cause the crash.


--------------------------------------------------------------------------------------------------


When adding those changes, the Code Analysis in IntelliJ found an issue with the minified April Fools snippet:
Code:
Warning:(835) Unbalanced number of expressions in assignment
Snippet highlighted:
Lua Code:
  1. local f,g,h,i,j,k,l,m=string.rep,string.format,math.floor,MAIL_MANAGER_GAMEPAD,MAIL_INBOX,zo_callLater,IsInGamepadPreferredMode;
Looks like the 'm' is extra there.


--------------------------------------------------------------------------------------------------


A couple other points you could do in case someone pulls the Github:
- Have separate dev/release branches with the default to release so it is safe to use. Better yet if the main branch can be usable as a git submodule/subtree.

- Add an additional file in the explicit LAM addon (ie "testVersioning.lua") and force update the library version:
Lua Code:
  1. LibStub:NewLibrary("LibAddonMenu-2.0", 9999)
Putting this in a separate file will help ensure it isn't pulled in. So it'll load the addon as r20 then bump the version number to testing and go from there.
Report comment to moderator  
Reply With Quote
Unread 06/09/16, 07:27 AM  
votan
 
votan's Avatar
AddOn Author - Click to view AddOns

Forum posts: 320
File comments: 514
Uploads: 17
Originally Posted by merlight
1) if there is no other add-on with properly released LAM, the user will end up with no LAM at all
I don't think, that would be wrong. If the addon, embedding an unreleased github version, is the only one using LAM2, causing an error is correct in my opinion.
Maybe the check should cause the Lua error dialog?
__________________
@votan73 (EU - megaserver)
Report comment to moderator  
Reply With Quote
Unread 06/09/16, 07:24 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 740
File comments: 471
Uploads: 24
Originally Posted by merlight
Originally Posted by sirinsidiator
I was thinking of setting a saved variable in an additional file of the standalone which will then set the version to 999 for developers.
If someone bundles it, the file doesn't get loaded and the default version is 0. It also needs to be included by hand at least once so it works.
You mean a global var, right? Then it becomes almost what I suggested in the past, with only a small change.

Lua Code:
  1. local MAJOR, MINOR = "LibAddonMenu-2.0", _LAM2_VERSION_NUMBER or -1

And set _LAM2_VERSION_NUMBER = 999 in the other file (loaded first, in stand-alone only).

I think this might be better than my previous suggestion, because there were two issues with it:
1) if there is no other add-on with properly released LAM, the user will end up with no LAM at all
2) you'd have to change all control/*.lua, add LibStub.SILENT and check that LAM is not nil first

Whereas the solution with global LAM version in stand-alone will just work, including the case where there's no other LAM version (version -1 is the highest in this case).
Right, I guess I could just define it directly and skip the saved variable. For the release on ESOUI the build script will just replace that part (like it does now) and remove the extra file, so only the github standalone will be version 999 and as soon as it is bundled it will become -1 and never load unless it is the only LAM copy available.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: