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,056
Total downloads:48,456
Favorites:199
MD5:
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 03/22/17, 07:01 PM  
Kyoma
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 31
Uploads: 3
Originally Posted by sirinsidiator
Hey Kyoma. Thanks for the contribution. Could you please make a pull request on github? Otherwise I'll loose track of who contributed what. It also makes it easier for me to review your proposed changes.

Originally Posted by Kyoma
Hey, lovely work from everybody that contributed to LAM. And while I dont consider myself as great as you all I do have a nice addition that I wanted to share. It is an expansion of the dropdown control to make it work with large amounts of entries. Most of the work is done by ZO_ScrollableComboBox but a few changes were needed to avoid issues with focus inside the dropdown list.

Code:
    control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control.container, dropdownData.scrollable and "ZO_ScrollableComboBox" or "ZO_ComboBox")
    ....
    local dropdown = control.dropdown
    dropdown:SetSortsItems(false) -- need to sort ourselves in order to be able to sort by value

	if dropdownData.scrollable then
		ZO_PreHook(dropdown, "ShowDropdownOnMouseUp", function(self)
			self.lastParent = self.m_scroll:GetParent()
			self.m_scroll:SetParent(ZO_Menus)
			ZO_Menus:BringWindowToTop()
		end)
		ZO_PreHook(dropdown, "HideDropdownInternal", function(self)
			self.m_scroll:SetParent(self.lastParent)
		end)
	end
Then all an addon author would need to do is add a "scrollable = true" property to their dropdown data entry and voila.
Ah ok, sure. Not too used to GitHub but I'll manage. But I discovered I forgot to account for width of the entries so I'll need to quickly add that first. Well....tomorrow atleast.
Report comment to moderator  
Reply With Quote
Unread 03/22/17, 02:57 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Hey Kyoma. Thanks for the contribution. Could you please make a pull request on github? Otherwise I'll loose track of who contributed what. It also makes it easier for me to review your proposed changes.

Originally Posted by Kyoma
Hey, lovely work from everybody that contributed to LAM. And while I dont consider myself as great as you all I do have a nice addition that I wanted to share. It is an expansion of the dropdown control to make it work with large amounts of entries. Most of the work is done by ZO_ScrollableComboBox but a few changes were needed to avoid issues with focus inside the dropdown list.

Code:
    control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control.container, dropdownData.scrollable and "ZO_ScrollableComboBox" or "ZO_ComboBox")
    ....
    local dropdown = control.dropdown
    dropdown:SetSortsItems(false) -- need to sort ourselves in order to be able to sort by value

	if dropdownData.scrollable then
		ZO_PreHook(dropdown, "ShowDropdownOnMouseUp", function(self)
			self.lastParent = self.m_scroll:GetParent()
			self.m_scroll:SetParent(ZO_Menus)
			ZO_Menus:BringWindowToTop()
		end)
		ZO_PreHook(dropdown, "HideDropdownInternal", function(self)
			self.m_scroll:SetParent(self.lastParent)
		end)
	end
Then all an addon author would need to do is add a "scrollable = true" property to their dropdown data entry and voila.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 03/22/17, 12:34 PM  
Kyoma
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 31
Uploads: 3
Hey, lovely work from everybody that contributed to LAM. And while I dont consider myself as great as you all I do have a nice addition that I wanted to share. It is an expansion of the dropdown control to make it work with large amounts of entries. Most of the work is done by ZO_ScrollableComboBox but a few changes were needed to avoid issues with focus inside the dropdown list.

Code:
    control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control.container, dropdownData.scrollable and "ZO_ScrollableComboBox" or "ZO_ComboBox")
    ....
    local dropdown = control.dropdown
    dropdown:SetSortsItems(false) -- need to sort ourselves in order to be able to sort by value

	if dropdownData.scrollable then
		ZO_PreHook(dropdown, "ShowDropdownOnMouseUp", function(self)
			self.lastParent = self.m_scroll:GetParent()
			self.m_scroll:SetParent(ZO_Menus)
			ZO_Menus:BringWindowToTop()
		end)
		ZO_PreHook(dropdown, "HideDropdownInternal", function(self)
			self.m_scroll:SetParent(self.lastParent)
		end)
	end
Then all an addon author would need to do is add a "scrollable = true" property to their dropdown data entry and voila.
Last edited by Kyoma : 03/22/17 at 07:00 PM.
Report comment to moderator  
Reply With Quote
Unread 02/09/17, 06:28 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Originally Posted by JohnnyKing94
Is there any ETA for the PR i made?

LINK: https://github.com/sirinsidiator/ESO...onMenu/pull/70
I haven't had time to update LAM yet, but I also haven't forgotten about it. Please be patient for a while longer. I'll try to update it as soon as I can, but I am pretty busy with RL and other ESO activities besides addons right now.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 02/09/17, 06:10 AM  
JohnnyKing94
 
JohnnyKing94's Avatar

Forum posts: 45
File comments: 6
Uploads: 0
Is there any ETA for the PR i made?

LINK: https://github.com/sirinsidiator/ESO...onMenu/pull/70
Report comment to moderator  
Reply With Quote
Unread 01/13/17, 05:07 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 123
File comments: 664
Uploads: 23
Originally Posted by sirinsidiator
Happy New Year to you too, Phinix!

The current version of LAM was actually never built with dynamic menus in mind. I am slowly pushing it in that direction, but there is still a long way to go.
For now you can try to call LAM.util.RequestRefreshIfNeeded after you called UpdateChoices:
Lua Code:
  1. MyDropdown:UpdateChoices(labels, values, tooltips) -- values and tooltips are optional
  2. LAM.util.RequestRefreshIfNeeded(MyDropdown)
You should also make sure that you use the latest version of LAM (r23).

Calling reloadUI directly from your settings panel is also highly discouraged as it makes for a very bad user experience and I will find you and hit you with a spoon until you start using the newly added requiresReload flag on your controls instead. :P
Thanks, I will give that a try. Also I will definitely switch to your reload method. I don't think I could handle being haunted by a maniacal spoon-wielding Maynard James Keenan doppelganger.

Just have to figure out how to hold off setting the name database entry to nil until the user actually reloads the UI, or cancel it if they don't. Since it is one control (button) controlling removal from another (dropdown) in my case.

Side note: I find the fortune teller's facial expressions in the spoon video intriguing.
Last edited by Phinix : 01/13/17 at 05:44 PM.
Report comment to moderator  
Reply With Quote
Unread 01/12/17, 02:34 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Originally Posted by Phinix
Happy new year, sirinsidiator.

Having a bit of trouble with a dropdown + button combo. Basically, I want to have a dropdown list of sorted names, and let the user select one. Then if they click the button, it deletes the name from the list.

I have registerForRefresh set on my panel, however when I click the button the name remains in the dropdown list until I /reloadui.

Is there any way to force the contents of the dropdown to refresh when I hit the button? I have tried a function that manually rebuilds my choice table when I hit the button, but it still won't refresh until a /reloadui.

EDIT:

I tried your workaround below using the CALLBACK_MANAGER and a global reference on the button, however it seems to not work with buttons since they aren't actually changing anything, it doesn't trigger a refresh of the other controls.

Of course, I can't put it on my dropdown as that will refresh all BUT the list...

Is there a way to trigger this exclusive refresh from a button control reference?

EDIT EDIT:

I tried setting a disabled function on my dropdown control to disable the button if nothing was selected, then set the selection back to nothing when I hit the button, thinking changing the button state from enabled to disabled MIGHT trigger the callback...

Nope.

EDIT EDIT EDIT:

I tried creating a new checkbox control that is always off but gets set on when you choose a name in the dropdown, and set back off when you hit the delete button, and attached the workaround callback to that control.

This still doesn't update the contents of the dropdown table.

EDIT EDIT EDIT EDIT:

So I just worked around this for now by adding a warning that clicking the delete button will reload the UI then added ReloadUI() to the button's function.
Happy New Year to you too, Phinix!

The current version of LAM was actually never built with dynamic menus in mind. I am slowly pushing it in that direction, but there is still a long way to go.
For now you can try to call LAM.util.RequestRefreshIfNeeded after you called UpdateChoices:
Lua Code:
  1. MyDropdown:UpdateChoices(labels, values, tooltips) -- values and tooltips are optional
  2. LAM.util.RequestRefreshIfNeeded(MyDropdown)
You should also make sure that you use the latest version of LAM (r23).

Calling reloadUI directly from your settings panel is also highly discouraged as it makes for a very bad user experience and I will find you and hit you with a spoon until you start using the newly added requiresReload flag on your controls instead. :P
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 01/11/17, 06:53 PM  
Phinix
 
Phinix's Avatar
AddOn Author - Click to view AddOns

Forum posts: 123
File comments: 664
Uploads: 23
Happy new year, sirinsidiator.

Having a bit of trouble with a dropdown + button combo. Basically, I want to have a dropdown list of sorted names, and let the user select one. Then if they click the button, it deletes the name from the list.

I have registerForRefresh set on my panel, however when I click the button the name remains in the dropdown list until I /reloadui.

Is there any way to force the contents of the dropdown to refresh when I hit the button? I have tried a function that manually rebuilds my choice table when I hit the button, but it still won't refresh until a /reloadui.

EDIT:

I tried your workaround below using the CALLBACK_MANAGER and a global reference on the button, however it seems to not work with buttons since they aren't actually changing anything, it doesn't trigger a refresh of the other controls.

Of course, I can't put it on my dropdown as that will refresh all BUT the list...

Is there a way to trigger this exclusive refresh from a button control reference?

EDIT EDIT:

I tried setting a disabled function on my dropdown control to disable the button if nothing was selected, then set the selection back to nothing when I hit the button, thinking changing the button state from enabled to disabled MIGHT trigger the callback...

Nope.

EDIT EDIT EDIT:

I tried creating a new checkbox control that is always off but gets set on when you choose a name in the dropdown, and set back off when you hit the delete button, and attached the workaround callback to that control.

This still doesn't update the contents of the dropdown table.

EDIT EDIT EDIT EDIT:

So I just worked around this for now by adding a warning that clicking the delete button will reload the UI then added ReloadUI() to the button's function.
Last edited by Phinix : 01/11/17 at 07:47 PM.
Report comment to moderator  
Reply With Quote
Unread 01/04/17, 06:35 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Re: Italian localization

Originally Posted by JohnnyKing94
I just made a PR on Github for the italian localization dude. Just check it out

LINK: https://github.com/sirinsidiator/ESO...onMenu/pull/70
Thanks! I'll take a look.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 01/04/17, 05:38 AM  
JohnnyKing94
 
JohnnyKing94's Avatar

Forum posts: 45
File comments: 6
Uploads: 0
Italian localization

I just made a PR on Github for the italian localization dude. Just check it out

LINK: https://github.com/sirinsidiator/ESO...onMenu/pull/70
Report comment to moderator  
Reply With Quote
Unread 12/26/16, 02:18 PM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Re: Re: Re: Re: Re: Re: Re: Custom controls not refreshing on init

Originally Posted by Aetheron
Originally Posted by sirinsidiator
Ah yes. I didn't try it myself and also didn't read the whole code when I wrote it.
RequestRefreshIfNeeded expects any control except for the panel (maybe something I should fix), so you can set a global reference on one of your controls and use that instead:

Lua Code:
  1. local panel = LAM:RegisterAddonPanel(...)
  2. local optionsData = {
  3.   {
  4.     type = "checkbox",
  5.     ...
  6.     reference = "MyAddonSettingControl1"
  7.   }
  8. }
  9.  
  10. ...
  11. CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(newPanel)
  12.   if(newPanel == panel) then
  13.     LAM.util.RequestRefreshIfNeeded(MyAddonSettingControl1)
  14.   end
  15. end)
This worked - mostly. Oddly, when I call the refresh function using a random control reference, all my controls are refreshed except for the one I used as a reference. If I call refresh twice using different control references, then everything gets refreshed. I wonder if there's some kind of callback re-entrancy check that's blocking the refresh on the initiating reference control? Anyway, I'm good for now. Are you planning a release with the bug fix anytime soon? If so, I may wait for that; otherwise I'll just use the work around.

Thanks for the help!
-A
That's right. The function is actually an internal one that is used to refresh all other controls on the panel when one is changed. It checks that the control is not the same as the one that was updated as it has already been refreshed. As this is only a workaround for a bug, I think it's should be okay.

Unfortunatley I don't have enough time to update it right now, so unless you want to wait a month or two, you should just go ahead and release your addon with this workaround.
__________________
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
Report comment to moderator  
Reply With Quote
Unread 12/26/16, 10:17 AM  
Aetheron
 
Aetheron's Avatar
AddOn Author - Click to view AddOns

Forum posts: 30
File comments: 61
Uploads: 1
Re: Re: Re: Re: Re: Re: Custom controls not refreshing on init

Originally Posted by sirinsidiator
Ah yes. I didn't try it myself and also didn't read the whole code when I wrote it.
RequestRefreshIfNeeded expects any control except for the panel (maybe something I should fix), so you can set a global reference on one of your controls and use that instead:

Lua Code:
  1. local panel = LAM:RegisterAddonPanel(...)
  2. local optionsData = {
  3.   {
  4.     type = "checkbox",
  5.     ...
  6.     reference = "MyAddonSettingControl1"
  7.   }
  8. }
  9.  
  10. ...
  11. CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(newPanel)
  12.   if(newPanel == panel) then
  13.     LAM.util.RequestRefreshIfNeeded(MyAddonSettingControl1)
  14.   end
  15. end)
This worked - mostly. Oddly, when I call the refresh function using a random control reference, all my controls are refreshed except for the one I used as a reference. If I call refresh twice using different control references, then everything gets refreshed. I wonder if there's some kind of callback re-entrancy check that's blocking the refresh on the initiating reference control? Anyway, I'm good for now. Are you planning a release with the bug fix anytime soon? If so, I may wait for that; otherwise I'll just use the work around.

Thanks for the help!
-A
Report comment to moderator  
Reply With Quote
Unread 12/26/16, 02:54 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Re: Re: Re: Re: Re: Custom controls not refreshing on init

Originally Posted by Aetheron
Hi again,
I've tried this work around, but it causes an error at line 122 in LibAddonMenu-2.lua - indexing a nil value. It seems that the control.panel is still nil when the created event is received.

-A
Ah yes. I didn't try it myself and also didn't read the whole code when I wrote it.
RequestRefreshIfNeeded expects any control except for the panel (maybe something I should fix), so you can set a global reference on one of your controls and use that instead:

Lua Code:
  1. local panel = LAM:RegisterAddonPanel(...)
  2. local optionsData = {
  3.   {
  4.     type = "checkbox",
  5.     ...
  6.     reference = "MyAddonSettingControl1"
  7.   }
  8. }
  9.  
  10. ...
  11. CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(newPanel)
  12.   if(newPanel == panel) then
  13.     LAM.util.RequestRefreshIfNeeded(MyAddonSettingControl1)
  14.   end
  15. 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 12/25/16, 07:03 PM  
Aetheron
 
Aetheron's Avatar
AddOn Author - Click to view AddOns

Forum posts: 30
File comments: 61
Uploads: 1
Re: Re: Re: Re: Custom controls not refreshing on init

Originally Posted by sirinsidiator
Originally Posted by Aetheron
Originally Posted by sirinsidiator
Hi. Thanks for the report. This is a bug, but as far as I can see it has been in since almost two years ago, back when I changed the panel creation routine to throttle control creation. The refresh callback is fired before the panel controls are actually created. Not sure how it could have worked before, unless you use a way outdated version of LAM or I am missing something obvious.

For now you can listen to LAM-PanelControlsCreated and trigger the refresh manually:
Lua Code:
  1. local panel = LAM:RegisterAddonPanel(...)
  2.  
  3. ...
  4. CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(newPanel)
  5.   if(newPanel == panel) then
  6.     LAM.util.RequestRefreshIfNeeded(panel)
  7.   end
  8. end)
It's possible I just remember it working when I first wrote Combat Reticle, then never noticed again (until recently) I also took about a year off from ESO in between.

One more question while I'm at it: is there a reason/advantage to delay settings panel initialization using the LAM-PanelControlsCreated event? I've always just initialized it in my onLoaded handler and it seems to work well.

Thanks,
-A
The LAM-PanelControlsCreated callback is fired when the settings panel finished creating all of its control elements after you open it for the first time. You mustn't move the panel initialization in there, as your panel would not show up anymore unless another addon's panel has finished creating it's controls.
My code just shows a workaround for the refresh callback not being called at the correct time and is independent of your initialization code.

As for why I added the throttling, that is just a measure to prevent the game from freezing / crashing when an addon has many options, as they were all created within one frame in the past.
Hi again,
I've tried this work around, but it causes an error at line 122 in LibAddonMenu-2.lua - indexing a nil value. It seems that the control.panel is still nil when the created event is received.

-A
Report comment to moderator  
Reply With Quote
Unread 12/25/16, 11:57 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 806
File comments: 516
Uploads: 25
Re: Re: Re: Custom controls not refreshing on init

Originally Posted by Aetheron
Originally Posted by sirinsidiator
Originally Posted by Aetheron
Hi,
I'm using custom controls to display textures in a bunch of subpanels and I've defined a refreshFunc for these controls that properly initializes the control. The problem is that the refresh function is only called when the control is changed, and not when it is first displayed. I'm thinking that LAM should call refresh on controls that have such a function defined just after panel creation as well as on refresh events. I also think something changed in LAM as my code used to work as-is. Is there a new method to do this (like an init function)?

Thanks,
-A
Hi. Thanks for the report. This is a bug, but as far as I can see it has been in since almost two years ago, back when I changed the panel creation routine to throttle control creation. The refresh callback is fired before the panel controls are actually created. Not sure how it could have worked before, unless you use a way outdated version of LAM or I am missing something obvious.

For now you can listen to LAM-PanelControlsCreated and trigger the refresh manually:
Lua Code:
  1. local panel = LAM:RegisterAddonPanel(...)
  2.  
  3. ...
  4. CALLBACK_MANAGER:RegisterCallback("LAM-PanelControlsCreated", function(newPanel)
  5.   if(newPanel == panel) then
  6.     LAM.util.RequestRefreshIfNeeded(panel)
  7.   end
  8. end)
It's possible I just remember it working when I first wrote Combat Reticle, then never noticed again (until recently) I also took about a year off from ESO in between.

One more question while I'm at it: is there a reason/advantage to delay settings panel initialization using the LAM-PanelControlsCreated event? I've always just initialized it in my onLoaded handler and it seems to work well.

Thanks,
-A
The LAM-PanelControlsCreated callback is fired when the settings panel finished creating all of its control elements after you open it for the first time. You mustn't move the panel initialization in there, as your panel would not show up anymore unless another addon's panel has finished creating it's controls.
My code just shows a workaround for the refresh callback not being called at the correct time and is independent of your initialization code.

As for why I added the throttling, that is just a measure to prevent the game from freezing / crashing when an addon has many options, as they were all created within one frame in the past.
__________________
>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: