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

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


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

You may see ZAM_Stats for an example of usage.


HOW TO USE:

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

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

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

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


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


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

Details on LAM2 data tables
2.0 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 (13)
File Name
Version
Size
Author
Date
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 10/21/14, 04:24 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 463
File comments: 545
Uploads: 20
Re: lam:OpenToPanel / update 5

Originally Posted by Criscal
Hi,

I'm getting an issue with calling ZO_TreeEntry_OnMouseUp on update 5 as well. In my addon, I'm using lam:OpenToPanel to get to the settings by clicking a button.

Criscal
Yup, reported a few posts below:
Originally Posted by Garkin
...

EDIT:
I have found another issue - ZO_OptionsWindow_ChangePanels() is now replaced by KEYBOARD_OPTIONS:ChangePanels(panel).
So in the LibAddonMenu-2.0.lua change lines 60-64 from:
Lua Code:
  1. ZO_OptionsWindow_ChangePanels(lam.panelID)
  2. if not lam.panelSubCategoryControl then
  3.     lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)]
  4. end
  5. ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true)
to single line:
Lua Code:
  1. KEYBOARD_OPTIONS:ChangePanels(lam.panelID)

...
Link to the version working with Update 5 is in the feature request here:
http://www.esoui.com/portal.php?id=5...&featureid=536
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 10/21/14, 03:50 PM  
Criscal
AddOn Author - Click to view AddOns

Forum posts: 6
File comments: 41
Uploads: 3
lam:OpenToPanel / update 5

Hi,

I'm getting an issue with calling ZO_TreeEntry_OnMouseUp on update 5 as well. In my addon, I'm using lam:OpenToPanel to get to the settings by clicking a button.

Criscal
Criscal is offline Report comment to moderator  
Reply With Quote
Unread 10/16/14, 06:45 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 463
File comments: 545
Uploads: 20
Re: Re: PTS Server patch

Originally Posted by Fyrakin
I found that controls\button.lua also need a little update

in function LAMCreateControl.button

Code:
+	local data = {}
+	data.tooltipText =buttonData.tooltip
+	button.data = data
	button:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
This is not just for the button widget. All widgets use functon ZO_Options_OnMouseEnter(control) in order to display tooltips. This function was changed in Update 5. Now it looks for tooltip text in the "control.data.tooltipText" instead of "control.tooltipText".
Probably the best solution would be change key name tooltip to tooltipText in the options table, but it means that all addons needs to be updated or at least there must be function that will update options table automatically.

Proposed changes:
LibAddonMenu-2.0.lua:
Code:
+   local UpdateOptionsTable

    function lam:RegisterOptionControls(addonID, optionsTable) --optionsTable = {sliderData, buttonData, etc}
+       UpdateOptionsTable(optionsTable)
        addonToOptionsMap[addonID] = optionsTable
    end

+   UpdateOptionsTable = function(optionsTable)
+       for _, widgetData in ipairs(optionsTable) do
+           if widgetData.type == "submenu" then
+               UpdateOptionsTable(widgetData.controls)
+           end
+           if widgetData.tooltipText == nil then
+               widgetData.tooltipText = widgetData.tooltip
+               widgetData.tooltip = nil
+           end
+       end
+   end
button.lua:
Code:
-   button.tooltipText = buttonData.tooltip
+   button.data = { tooltipText = buttonData.tooltipText }
colorpicker.lua:
Code:
-   control.tooltipText = colorpickerData.tooltip
dropdown.lua:
Code:
-   control.tooltipText = dropdownData.tooltip
editbox.lua:
Code:
-   control.tooltipText = editboxData.tooltip
checkbox.lua:
Code:
-   control.tooltipText = checkboxData.tooltip
slider.lua:
Code:
-   control.tooltipText = sliderData.tooltip
submenu.lua:
Code:
-   if submenuData.tooltip then
+   if submenuData.tooltipText then
-       label.tooltipText = submenuData.tooltip
+       label.data = { tooltipText = submenuData.tooltipText }
        label:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
        label:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
    end
texture.lua:
Code:
-   if textureData.tooltip then
+   if textureData.tooltipText then
        texture:SetMouseEnabled(true)
-       texture.tooltipText = textureData.tooltip
+       texture.data = { tooltipText = textureData.tooltipText }
        texture:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
        texture:SetHandler("OnMouseEnter", ZO_Options_OnMouseExit)
    end
(And of course, you will need to increase all widget versions)
Last edited by Garkin : 10/16/14 at 06:58 AM.
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 10/16/14, 02:00 AM  
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 37
File comments: 205
Uploads: 4
Re: PTS Server patch

I found that controls\button.lua also need a little update

in function LAMCreateControl.button

Code:
+	local data = {}
+	data.tooltipText =buttonData.tooltip
+	button.data = data
	button:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
Fyrakin is online now Report comment to moderator  
Reply With Quote
Unread 10/15/14, 06:20 PM  
neonatura
 
neonatura's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 1
Uploads: 1
PTS Server patch

Originally Posted by Garkin
It seems that it will need just a small change.
May not be fair.. anything under 1000 lines is small to a coder..

The following changes worked for me. I tested it on both 100009 and 100010 (PTS) api versions.

At the top add:
Code:
local apiVersion = 100009
At the bottom add:
Code:
local function InitApiVer()
    if KEYBOARD_OPTIONS then
        apiVersion = 100010
    end
end

--INITIALIZING
InitApiVer()
...
And then in the OpenToPanel function:
Code:
			ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]:SetOpen(true)
			SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT)
+			if apiVersion < 100010 then
				ZO_OptionsWindow_ChangePanels(lam.panelID)
+			else
+				KEYBOARD_OPTIONS:ChangePanels(lam.panelID)
+			end
			if not lam.panelSubCategoryControl then
				lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)]
			end
+			if apiVersion < 100010 then
				ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true)
+                        end
			panel:SetHidden(false)
In CreateAddonSettingsPanel function:
Code:
ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")] or controlPanelName["en"])

		lam.panelID = _G[controlPanelID]
		
+		if apiVersion < 100010 then 
			ZO_PreHook("ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
+                else
+			ZO_PreHook(ZO_SharedOptions, "ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
+                end
		
		LAMSettingsPanelCreated = true
And finally, in CreateAddonList:
Code:
	list.controlType = OPTIONS_CUSTOM
	list.panel = lam.panelID
	
+	if apiVersion < 100010 then 
		ZO_OptionsWindow_InitializeControl(list)
+	else
+		list.data = {}
+		list.data.controlType = OPTIONS_CUSTOM
+		list.data.panel = lam.panelID
+		KEYBOARD_OPTIONS:InitializeControl(list)
+	end
neonatura is offline Report comment to moderator  
Reply With Quote
Unread 10/14/14, 07:29 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 107
Uploads: 1
Thanks, guys!
Seerah is offline Report comment to moderator  
Reply With Quote
Unread 10/14/14, 08:58 AM  
Randactyl
 
Randactyl's Avatar
AddOn Author - Click to view AddOns

Forum posts: 37
File comments: 83
Uploads: 10
Originally Posted by Garkin
I don't think that it is depreciated, function ZO_OptionsWindow_InitializeControl still works.
I wonder what will happen when gamepad options will be available. My guess is that there will be one common function (such as ZO_OptionsWindow_InitializeControl) which will check if IsInGamepadPreferredMode() and then call InitializeControl method of keyboard or gamepad options.
That would make sense when gamepad stuff decides to show up. I only said this because of their included comment: "keep this around for backwards compatibility"
__________________
Randactyl | NA Megaserver | Blood for the Pact!
Author of Imperialization, Dye Station Achievement Links, and Stock Up
Maintainer of: Advanced Filters, Inventory Grid View, Item Saver, and libFilters
Randactyl is offline Report comment to moderator  
Reply With Quote
Unread 10/14/14, 05:36 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 463
File comments: 545
Uploads: 20
Originally Posted by Randactyl
Originally Posted by Garkin
It seems that it will need just a small change.
Came here to give these details and Garkin beat me to it without even being able to log in!

Also, ZO_OptionsWindow_InitializeControl seems to be depreciated. Might as well change line 301 from
Lua Code:
  1. ZO_OptionsWindow_InitializeControl(list)
to
Lua Code:
  1. KEYBOARD_OPTIONS:InitializeControl(list)
I don't think that it is depreciated, function ZO_OptionsWindow_InitializeControl still works.
I wonder what will happen when gamepad options will be available. My guess is that there will be one common function (such as ZO_OptionsWindow_InitializeControl) which will check if IsInGamepadPreferredMode() and then call InitializeControl method of keyboard or gamepad options.
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 10/14/14, 01:18 AM  
Randactyl
 
Randactyl's Avatar
AddOn Author - Click to view AddOns

Forum posts: 37
File comments: 83
Uploads: 10
Originally Posted by Garkin
It seems that it will need just a small change.
Came here to give these details and Garkin beat me to it without even being able to log in!

Also, ZO_OptionsWindow_InitializeControl seems to be depreciated. Might as well change line 301 from
Lua Code:
  1. ZO_OptionsWindow_InitializeControl(list)
to
Lua Code:
  1. KEYBOARD_OPTIONS:InitializeControl(list)
__________________
Randactyl | NA Megaserver | Blood for the Pact!
Author of Imperialization, Dye Station Achievement Links, and Stock Up
Maintainer of: Advanced Filters, Inventory Grid View, Item Saver, and libFilters
Randactyl is offline Report comment to moderator  
Reply With Quote
Unread 10/13/14, 08:03 PM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 463
File comments: 545
Uploads: 20
Originally Posted by Atropos
Seems like this might need an update for 1.5 now live on the PTS

Lua Code:
  1. EsoUI/Common/ZO_Options/ZO_SharedOptions.lua:23: attempt to index a nil value
  2. stack traceback:
  3.     EsoUI/Common/ZO_Options/ZO_SharedOptions.lua:23: in function 'ZO_SharedOptions:InitializeControl'
  4.     EsoUI/Common/ZO_Options/Keyboard/ZO_Options_Keyboard.lua:61: in function 'ZO_KeyboardOptions:InitializeControl'
  5.     EsoUI/Common/ZO_Options/Keyboard/ZO_Options_Keyboard.lua:98: in function 'ZO_OptionsWindow_InitializeControl'
  6.     user:/AddOns/FoundryTacticalCombat/lib/LAM/LibAddonMenu-2.0.lua:300: in function 'CreateAddonList'
  7.     user:/AddOns/FoundryTacticalCombat/lib/LAM/LibAddonMenu-2.0.lua:308: in function '(main chunk)'

Thanks for all your hard work on this lib!
It seems that it will need just a small change.

Change lines 297 and 298 in LibAddonMenu-2.0.lua:
Lua Code:
  1. list.controlType = OPTIONS_CUSTOM
  2. list.panel = lam.panelID
to:
Lua Code:
  1. list.data = {}
  2. list.data.controlType = OPTIONS_CUSTOM
  3. list.data.panel = lam.panelID

It is untested as I'm currently not able login to the PTS (I'm not getting email with access code )


EDIT:
I have found another issue - ZO_OptionsWindow_ChangePanels() is now replaced by KEYBOARD_OPTIONS:ChangePanels(panel).
So in the LibAddonMenu-2.0.lua change lines 60-64 from:
Lua Code:
  1. ZO_OptionsWindow_ChangePanels(lam.panelID)
  2. if not lam.panelSubCategoryControl then
  3.     lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)]
  4. end
  5. ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true)
to single line:
Lua Code:
  1. KEYBOARD_OPTIONS:ChangePanels(lam.panelID)

line 200 from:
Lua Code:
  1. local function HandlePanelSwitching(panel)
to:
Lua Code:
  1. local function HandlePanelSwitching(self, panel)

And line 234 from:
Lua Code:
  1. ZO_PreHook("ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
to:
Lua Code:
  1. ZO_PreHook(ZO_SharedOptions, "ChangePanels", HandlePanelSwitching)
Last edited by Garkin : 10/16/14 at 05:38 PM.
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 10/13/14, 07:09 PM  
Atropos
 
Atropos's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 67
Uploads: 1
Seems like this might need an update for 1.5 now live on the PTS

Lua Code:
  1. EsoUI/Common/ZO_Options/ZO_SharedOptions.lua:23: attempt to index a nil value
  2. stack traceback:
  3.     EsoUI/Common/ZO_Options/ZO_SharedOptions.lua:23: in function 'ZO_SharedOptions:InitializeControl'
  4.     EsoUI/Common/ZO_Options/Keyboard/ZO_Options_Keyboard.lua:61: in function 'ZO_KeyboardOptions:InitializeControl'
  5.     EsoUI/Common/ZO_Options/Keyboard/ZO_Options_Keyboard.lua:98: in function 'ZO_OptionsWindow_InitializeControl'
  6.     user:/AddOns/FoundryTacticalCombat/lib/LAM/LibAddonMenu-2.0.lua:300: in function 'CreateAddonList'
  7.     user:/AddOns/FoundryTacticalCombat/lib/LAM/LibAddonMenu-2.0.lua:308: in function '(main chunk)'

Thanks for all your hard work on this lib!
__________________
Founder and Creator of Tamriel Foundry
Guildmaster of Entropy Rising
Atropos is offline Report comment to moderator  
Reply With Quote
Unread 08/02/14, 07:09 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 463
File comments: 545
Uploads: 20
Originally Posted by wmrojer
Documentation for the "default" parameter for the colorpicker widget is wrong in the controls\colorpicker.lua

In the lua file
Lua Code:
  1. default = {defaults.r, defaults.g, defaults.b, defaults.a}, --(optional) table of default color values

But here on the web its
Lua Code:
  1. default = {r=defaults.r, g=defaults.g, b=defaults.b, a=defaults.a}, --(optional) table of default color values

Only the variant described here on the web works. (Which is a pain imho, since it's makes for a much more complicated code on my side )
<...snip...>
The best way I have found is using the ZO_ColorDef object.

Lua Code:
  1. local defaultColor = ZO_ColorDef:New(1,1,1,1)
  2. local myColor = ZO_ColorDef:New(unpack(savedVars.color))
  3.  
  4. -- definition of the colorpicker widget:
  5. {
  6.    type = "colorpicker",
  7.    name = "Colorpicker name",
  8.    tooltip = "Colorpicker tooltip text",
  9.    getFunc = function() return myColor:UnpackRGBA() end,
  10.    setFunc = function(...)
  11.          myColor:SetRGBA(...)
  12.          savedVars.color = {...}
  13.       end,
  14.    default = defaultColor, --or you can use directly default color definition object like ZO_NORMAL_TEXT or ZO_ERROR_COLOR
  15. },
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 08/02/14, 06:12 AM  
wmrojer

Forum posts: 2
File comments: 51
Uploads: 0
Documentation for the "default" parameter for the colorpicker widget is wrong in the controls\colorpicker.lua

In the lua file
Lua Code:
  1. default = {defaults.r, defaults.g, defaults.b, defaults.a}, --(optional) table of default color values

But here on the web its
Lua Code:
  1. default = {r=defaults.r, g=defaults.g, b=defaults.b, a=defaults.a}, --(optional) table of default color values

Only the variant described here on the web works. (Which is a pain imho, since it's makes for a much more complicated code on my side )

By just adding a few lines to the controls\colorpicker.lua both variants can be supported.
Lua Code:
  1. local function UpdateValue(control, forceDefault, valueR, valueG, valueB, valueA)
  2.     if forceDefault then    --if we are forcing defaults
  3.         local color = control.data.default
  4.         if color.r ~= nil and color.g ~= nil and color.b ~= nil then
  5.             valueR, valueG, valueB, valueA = color.r, color.g, color.b, color.a
  6.         else
  7.             valueR, valueG, valueB, valueA = color[1], color[2], color[3], color[4]
  8.         end
  9.         control.data.setFunc(valueR, valueG, valueB, valueA or 1)
  10.     elseif valueR and valueG and valueB then
  11.         control.data.setFunc(valueR, valueG, valueB, valueA or 1)
  12.         --after setting this value, let's refresh the others to see if any should be disabled or have their settings changed
  13.         if control.panel.data.registerForRefresh then
  14.             cm:FireCallbacks("LAM-RefreshPanel", control)
  15.         end
  16.     else
  17.         valueR, valueG, valueB, valueA = control.data.getFunc()
  18.     end
  19.  
  20.     control.thumb:SetColor(valueR, valueG, valueB, valueA or 1)
  21. end
Last edited by wmrojer : 08/02/14 at 06:19 AM.
wmrojer is offline Report comment to moderator  
Reply With Quote
Unread 07/28/14, 03:50 PM  
Seerah
Fishing Trainer
 
Seerah's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 642
File comments: 107
Uploads: 1
Originally Posted by Atropos
Turns out this is the link I need: http://www.esoui.com/portal.php?&id=5&pageid=15
Yep, that's linked at the bottom of the main docs page.
Seerah is offline Report comment to moderator  
Reply With Quote
Unread 07/28/14, 01:04 PM  
Atropos
 
Atropos's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3
File comments: 67
Uploads: 1
Hi Seerah,

Thanks for the response, glad to know this is easier than I initially thought. I looked over the docs on your portal but it wasn't obvious to me at the time that this was possible.

Turns out this is the link I need: http://www.esoui.com/portal.php?&id=5&pageid=15

I'll take another crack at this and try to get FTC running on AddonMenu2.0 for my next update. Thanks for your support.

Atropos
__________________
Founder and Creator of Tamriel Foundry
Guildmaster of Entropy Rising
Atropos is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump:

Support AddOn Development!

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