ZAM's Minion, currently in open beta, is a new AddOn manager optimized for use with ESO. Install, update & manage AddOns... Learn more!
Download
(30 Kb)
Download
Updated: 02/22/15 11:09 AM
Pictures
File Info
Compatibility:
Update 6 (1.6.5)
Update 5 (1.5.2)
Updated:02/22/15 11:09 AM
Created:02/14/14 10:28 PM
Downloads:19,549
Favorites:141
MD5:
1.6.5
LibAddonMenu  Popular! (More than 5000 hits)
Version: 2.0 r17
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
(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 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 (15)
File Name
Version
Size
Author
Date
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 Yesterday, 04:27 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 167
Uploads: 11
Originally Posted by Ayantir
little request, allow us to execute code when reverting to default.
https://github.com/sirinsidiator/ESO...Menu/issues/23

Originally Posted by Ayantir
Same request for tooltips.
https://github.com/sirinsidiator/ESO...Menu/issues/24

There is still a bit of RL work that eats up all of my daily coding time, but once that is over I'll look into those.
sirinsidiator is offline Report comment to moderator  
Reply With Quote
Unread Yesterday, 04:10 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 167
Uploads: 11
Originally Posted by SnowmanDK
Is there a problem with textures?

The code below just makes a gap in the menu. No graphics are shown.
Not even the tooltip is shown.
All other controls works fine.
Lua Code:
  1. POIsubmenuControls:insert({ -- divider
  2.     type = "texture",
  3.     width = "full",
  4.     image = "Destinations/misc/divider.dds",
  5.     imageWidth = 510,
  6.     imageHeight = 9,
  7.     tooltip = "test",
  8. })
I have added "Libs/LibAddonMenu-2.0/controls/texture.lua" to my config.
I assume image path is based on Addons as root folder.
I also assume that the image format is the same as for pins.
What am I missing?
The options look fine.
I made the experience that image files need to have a width and height with a power of 2. Try to resize the image to 512x16.
If that does not help, you can also try to close the game and delete the ShaderCache.cooked file. That also seems to help with texture problems quite often.
sirinsidiator is offline Report comment to moderator  
Reply With Quote
Unread 04/25/15, 03:11 PM  
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view AddOns

Forum posts: 103
File comments: 568
Uploads: 8
Is there a problem with textures?

The code below just makes a gap in the menu. No graphics are shown.
Not even the tooltip is shown.
All other controls works fine.
Lua Code:
  1. POIsubmenuControls:insert({ -- divider
  2.     type = "texture",
  3.     width = "full",
  4.     image = "Destinations/misc/divider.dds",
  5.     imageWidth = 510,
  6.     imageHeight = 9,
  7.     tooltip = "test",
  8. })
I have added "Libs/LibAddonMenu-2.0/controls/texture.lua" to my config.
I assume image path is based on Addons as root folder.
I also assume that the image format is the same as for pins.
What am I missing?
__________________
My addons: Destinations, ChatStamp and Bank Manager Revived
Last edited by SnowmanDK : 04/25/15 at 03:11 PM.
SnowmanDK is offline Report comment to moderator  
Reply With Quote
Unread 04/21/15, 03:33 AM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 205
File comments: 283
Uploads: 12
Same request for tooltips.

Why :
If I disable a control, user don't know why.
So we explain on tooltips.
Sometimes the reason isin LAM, sometime not. Sometimes it can be combinaisons of reasons.
If I try to cheat and changing tooltips when I change an option

ex :

Lua Code:
  1. optionsTable[index] = {
  2.     type = "checkbox",
  3.     name = pChat.lang.useESOcolors,
  4.     tooltip = pChat.lang.useESOcolorsTT,
  5.     getFunc = function() return pChat.opts.useESOcolors end,
  6.     setFunc = function(newValue)
  7.         pChat.opts.useESOcolors = newValue
  8.         pChat.initLAMTooltips()
  9.     end,
  10.     width = "full",
  11.     default = defaults.useESOcolors,
  12. }
  13.  
  14.  
  15. function pChat.initLAMTooltips()
  16.  
  17.     if pChat.opts.useESOcolors then
  18.        
  19.         pChat.lam.sayTT = pChat.lang.useESOcolorsErrorTT
  20.         ....
  21.     end
  22.    
  23. end
  24.  
  25. optionsTable[index] = {
  26.     type = "colorpicker",
  27.     name = pChat.lang.say,
  28.     tooltip = pChat.lam.sayTT,
  29.     getFunc = function() return pChat.getColour(pChat.opts.colours[2*CHAT_CHANNEL_SAY]) end,
  30.     setFunc = function(r, g, b) pChat.opts.colours[2*CHAT_CHANNEL_SAY] = pChat.makeColour(r, g, b) end,
  31.     default = pChat.defaultColour(defaults.colours[2*CHAT_CHANNEL_SAY]),
  32.     disabled = function() return pChat.opts.useESOcolors end,
  33. }

It won't work neither. Control defined with pChat.lang.say will still get its old tooltip because LAM optionTable is only refreshed when you :RegisterOptionControls. I'll could rebuild my optionsTable with

Lua Code:
  1. LAM:RegisterOptionControls("pChatOptions", optionsTable)
in order to work, but generally users change their multiple options before leaving it.
I've also tried to add in my setFunc : LAM:RegisterOptionControls("pChatOptions", optionsTable)
I won't work neither.

If for a lot of addons, building table only at the startup is a good choice, when you get an addon with huge settings panels and complex code to decide if or not an option is enabled, maybe an optional setting in the controls could be interesting.

Lua Code:
  1. name= "blabla",
  2. getfunc = ...
  3. setFunc = ..
  4. refreshPanel = true




-----------


For the default, I found the trick because my need was on a dropdown.
If you cannot set a func in your "default" parameter, set it in your setFunc parameter.

and write something like this :
In this exemple. I set a sound ID in my db and I show its localized string.


Lua Code:
  1. index = index + 1
  2.     optionsTable[index] = {
  3.         type = "dropdown",
  4.         name = pChat.lang.soundforincwhisps,
  5.         tooltip = pChat.lang.soundforincwhispsTT,
  6.         choices = {
  7.             pChat.lang.soundforincwhispschoice[SOUNDS.NONE],
  8.             pChat.lang.soundforincwhispschoice[SOUNDS.NEW_NOTIFICATION],
  9.             pChat.lang.soundforincwhispschoice[SOUNDS.DEFAULT_CLICK],
  10.             pChat.lang.soundforincwhispschoice[SOUNDS.EDIT_CLICK],
  11.         },
  12.         width = "full",
  13.         default = defaults.soundforincwhisps, --> SOUNDS.NEW_NOTIFICATION
  14.         getFunc = function() return pChat.lang.soundforincwhispschoice[pChat.opts.soundforincwhisps] end,
  15.         setFunc = function(choice)
  16.             if choice == pChat.lang.soundforincwhispschoice[SOUNDS.NONE] then
  17.                 pChat.opts.soundforincwhisps = SOUNDS.NONE
  18.                 PlaySound(SOUNDS.NONE)
  19.             elseif choice == pChat.lang.soundforincwhispschoice[SOUNDS.NEW_NOTIFICATION] then
  20.                 pChat.opts.soundforincwhisps = SOUNDS.NEW_NOTIFICATION
  21.                 PlaySound(SOUNDS.NEW_NOTIFICATION)
  22.             elseif choice == pChat.lang.soundforincwhispschoice[SOUNDS.DEFAULT_CLICK] then
  23.                 pChat.opts.soundforincwhisps = SOUNDS.DEFAULT_CLICK
  24.                 PlaySound(SOUNDS.DEFAULT_CLICK)
  25.             elseif choice == pChat.lang.soundforincwhispschoice[SOUNDS.EDIT_CLICK] then
  26.                 pChat.opts.soundforincwhisps = SOUNDS.EDIT_CLICK
  27.                 PlaySound(SOUNDS.EDIT_CLICK)
  28.             else
  29.                 -- When clicking on LAM default button
  30.                 pChat.opts.soundforincwhisps = defaults.soundforincwhisps
  31.             end
  32.            
  33.         end,
  34.     }

When user click on a button, a sound is played (see the setFunc).
When user click on "reinit" button, "default" send value to setFunc and sound is not played. because I send the stored value, not a dropdown one.

When user don't get a saved vars, Zo_VavedVars will set the value to (here) defaults.soundforincwhisps.
Then the getFunc will handle it. I was maybe tired to see it.

If you want some exemple of complex LAM build tables, I recommand you pChat and MiniMap. there is good example inside.
__________________
Currently working on my Addons

My Addons: pChat, pNames, MultiCraft, Roomba, CraftCompare, Guild Notificator, (...)
My little french Guild: Cercle de l'Eveil
Ayantir is online now Report comment to moderator  
Reply With Quote
Unread 04/18/15, 06:21 PM  
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view AddOns

Forum posts: 205
File comments: 283
Uploads: 12
little request, allow us to execute code when reverting to default.

the code will look like getFunc

Lua Code:
  1. default = function()
  2.  
  3.     -- do stuff
  4.     return value
  5.  
  6. end,

Thank you.
__________________
Currently working on my Addons

My Addons: pChat, pNames, MultiCraft, Roomba, CraftCompare, Guild Notificator, (...)
My little french Guild: Cercle de l'Eveil
Ayantir is online now Report comment to moderator  
Reply With Quote
Unread 03/24/15, 12:32 PM  
Isilvar307

Forum posts: 0
File comments: 5
Uploads: 0
Re: Re: Need help please

I thought TiEmote Extented is separate mod with extra features from TiEmote and i checked TiEmote's version.
But for Undiscovered i thought it was still the previous version.
When i checked in this link it was not in the lists yet.
https://github.com/sirinsidiator/ESO...ons-using-LAM2
Well, i guess i have to use TiEmote Extented from now on.

As for the Minion, it has a bug which i reported and has been fixed one time, but with every update its disfixes!
That is why i am using NMM and all everything is fine.

Thanks alot for the info about those two addons.
Isilvar307 is offline Report comment to moderator  
Reply With Quote
Unread 03/23/15, 05:24 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 167
Uploads: 11
Re: Need help please

Originally Posted by Isilvar307
I do not have any knowledge for editing addons.
But i checked from each addon's "txt", i saw in that APB and SkyShards have "OptionalDependsOn: LibAddonMenu-2.0 ", SimpleClock and "OptionalDependsOn: LibAddonMenu-1.0 ", TiEmote does not have and Undiscovered have "OptionalDependsOn: LibStub LibAddonMenu".
So what must i do?
Just replace "LibAddonMenu-1.0" with "-2.0" and "LibStub LibAddonMenu" with "LibAddonMenu-2.0"?
Also i never used this addon LibAddonMenu before.
Should i download and use it somehow in order to update the addons i have?
And i agree 100% with joshmiller83, there are many people who don't know what to do for this matter and its not our work to update those addons, one mistake can cause bad issues in the game which may not be fixed by just uninstalling the addon, but it may need to do a major repair or the whole game reinstall from begin, that is something people do not want who have slow internet.
Neither is it my job to update the addons that use LibAddonMenu.
I am not sure why you think that you have to update or use LAM2 yourself?
It is a library that is included in other addons. If they are not updated, then you should report it to their respective comment section or ask in the addon requests forum if somebody can update it.

Also TiEmote and Undiscovered have both been updated to work with LAM2 already.
If you haven't already done so, you should start using Minion which will keep track of your addons and allows you to update them with a single click.
sirinsidiator is offline Report comment to moderator  
Reply With Quote
Unread 03/22/15, 12:10 PM  
Isilvar307

Forum posts: 0
File comments: 5
Uploads: 0
Need help please

I do not have any knowledge for editing addons.
But i checked from each addon's "txt", i saw in that APB and SkyShards have "OptionalDependsOn: LibAddonMenu-2.0 ", SimpleClock and "OptionalDependsOn: LibAddonMenu-1.0 ", TiEmote does not have and Undiscovered have "OptionalDependsOn: LibStub LibAddonMenu".
So what must i do?
Just replace "LibAddonMenu-1.0" with "-2.0" and "LibStub LibAddonMenu" with "LibAddonMenu-2.0"?
Also i never used this addon LibAddonMenu before.
Should i download and use it somehow in order to update the addons i have?
And i agree 100% with joshmiller83, there are many people who don't know what to do for this matter and its not our work to update those addons, one mistake can cause bad issues in the game which may not be fixed by just uninstalling the addon, but it may need to do a major repair or the whole game reinstall from begin, that is something people do not want who have slow internet.
Last edited by Isilvar307 : 03/22/15 at 12:18 PM.
Isilvar307 is offline Report comment to moderator  
Reply With Quote
Unread 03/17/15, 11:09 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 167
Uploads: 11
Re: decimals on slider control

Originally Posted by Carter_DC
Could you add a round to x decimals option for the sliders that uses decimal increments ?

On a 0 to 10 slider with 0.1 increments, i can't read the correct values, cuz of all the decimals that show up in the text edit under the slider.

I can't seem to get any results when trying to modify the slider.lua (guess the lib is loaded one time only with whatever other addon i have that needs it)
I opened a ticket for you over at github and will look into it when I have more time. Currently a bit busy with other things.
You can try votan's workarounds for now. Docs are located here.
sirinsidiator is offline Report comment to moderator  
Reply With Quote
Unread 03/17/15, 08:05 AM  
votan
 
votan's Avatar
AddOn Author - Click to view AddOns

Forum posts: 90
File comments: 108
Uploads: 6
Re: decimals on slider control

Originally Posted by Carter_DC
Could you add a round to x decimals option for the sliders that uses decimal increments ?

On a 0 to 10 slider with 0.1 increments, i can't read the correct values, cuz of all the decimals that show up in the text edit under the slider.
Workaround 1: Multiple your value in the getFunc and divide it in the setFunc.
Workaround 2: Register your own slider control type. See docs. (I did not do that before)

Originally Posted by Carter_DC
I can't seem to get any results when trying to modify the slider.lua (guess the lib is loaded one time only with whatever other addon i have that needs it)
Correct. That's why it was so important, that everybody updates to r17.
__________________
@votan73 (EU - megaserver)
votan is online now Report comment to moderator  
Reply With Quote
Unread 03/17/15, 07:49 AM  
Carter_DC
AddOn Author - Click to view AddOns

Forum posts: 11
File comments: 9
Uploads: 3
decimals on slider control

Could you add a round to x decimals option for the sliders that uses decimal increments ?

On a 0 to 10 slider with 0.1 increments, i can't read the correct values, cuz of all the decimals that show up in the text edit under the slider.

I can't seem to get any results when trying to modify the slider.lua (guess the lib is loaded one time only with whatever other addon i have that needs it)
Carter_DC is offline Report comment to moderator  
Reply With Quote
Unread 02/24/15, 02:04 AM  
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view AddOns

Forum posts: 129
File comments: 167
Uploads: 11
Re: LAM2 r17?

Originally Posted by joshmiller83
How hard is it for someone who isn't an author to update an addon to r17 from r14 or r16? Is there a lot of changes or is it pretty much a simple drag'n'drop? I am not illiterate or anything as I have been in tech support and IT/IS for 12 years now but I am not skilled in LUA yet, or any other language anymore.
Simply replacing the files should be enough. You can see a list of all addons (from esoui) that use LAM2 here.

There is one scenario where you have to update the addon code, but it will print a different warning in chat should this be the case.
sirinsidiator is offline Report comment to moderator  
Reply With Quote
Unread 02/23/15, 06:49 PM  
joshmiller83
AddOn Super User
 
joshmiller83's Avatar
Premium Member

Forum posts: 49
File comments: 173
Uploads: 0
Question LAM2 r17?

How hard is it for someone who isn't an author to update an addon to r17 from r14 or r16? Is there a lot of changes or is it pretty much a simple drag'n'drop? I am not illiterate or anything as I have been in tech support and IT/IS for 12 years now but I am not skilled in LUA yet, or any other language anymore.
joshmiller83 is offline Report comment to moderator  
Reply With Quote
Unread 02/14/15, 06:54 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view AddOns

Forum posts: 805
File comments: 1078
Uploads: 33
Re: Re: Re: Re: Dropdown

Originally Posted by votan
Originally Posted by Garkin
Counter should be panel specific, probably something like I have done in my fontblock widget (see new update of Srendarr or Azurah).
Ah, a counter per parent. Good idea, but not reliable. For example in "No, thank you" parent:GetName() and controlName and dropdownData.reference are empty string. Causing "Duplicate name: Combobox1"
Others may have the same problem.
panel is using LAMCreateControl.scrollCount already. So I think it is ok this way:
Lua Code:
  1. local comboboxCount
  2. local name = parent:GetName()
  3. if not name or #name == 0 then
  4.     name = "LAM"
  5.     comboboxCount = LAMCreateControl.comboboxCount or 0
  6.     comboboxCount = comboboxCount + 1
  7.     LAMCreateControl.comboboxCount = comboboxCount
  8. else
  9.     comboboxCount = parent.comboboxCount or 0
  10.     comboboxCount = comboboxCount + 1
  11.     parent.comboboxCount = comboboxCount
  12. end
  13. control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control, "ZO_ComboBox")
For "good" parents, the dropdowns have a count per parent and as a failback there is a global counter, too.
Thats because parent could be also submenu, not just panel.

Lua Code:
  1. local panel = parent.panel or parent
  2. if not panel.comboboxCount then
  3.     panel.comboboxCount = 0
  4. end
  5. panel.comboboxCount = panel.comboboxCount + 1
  6.  
  7. control.combobox = wm:CreateControlFromVirtual(panel:GetName().."Combobox"..panel.comboboxCount, control, "ZO_ComboBox")
__________________
@Garkin / EU (CSF guild) / NA (Maelstrom guild)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)
Updated, modified and test addon versions are in my DROPBOX folder.
Garkin is offline Report comment to moderator  
Reply With Quote
Unread 02/14/15, 04:02 AM  
votan
 
votan's Avatar
AddOn Author - Click to view AddOns

Forum posts: 90
File comments: 108
Uploads: 6
Re: Re: Re: Dropdown

Originally Posted by Garkin
Counter should be panel specific, probably something like I have done in my fontblock widget (see new update of Srendarr or Azurah).
Ah, a counter per parent. Good idea, but not reliable. For example in "No, thank you" parent:GetName() and controlName and dropdownData.reference are empty string. Causing "Duplicate name: Combobox1"
Others may have the same problem.
panel is using LAMCreateControl.scrollCount already. So I think it is ok this way:
Lua Code:
  1. local comboboxCount
  2. local name = parent:GetName()
  3. if not name or #name == 0 then
  4.     name = "LAM"
  5.     comboboxCount = LAMCreateControl.comboboxCount or 0
  6.     comboboxCount = comboboxCount + 1
  7.     LAMCreateControl.comboboxCount = comboboxCount
  8. else
  9.     comboboxCount = parent.comboboxCount or 0
  10.     comboboxCount = comboboxCount + 1
  11.     parent.comboboxCount = comboboxCount
  12. end
  13. control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control, "ZO_ComboBox")
For "good" parents, the dropdowns have a count per parent and as a failback there is a global counter, too.
__________________
@votan73 (EU - megaserver)
votan is online now Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: