View Single Post
02/23/15, 05:39 AM   #6
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by votan View Post
Hi, Garkin.

It has something to do with creating those controls outside LAM settings panel.
I'm not 100% sure, but I think it was "No, Thank You" which was creating a control named "Combobox1". Which did not conflict, but it is not a wise name.
The name of the parent and not it's panel is used as a prefix and therefore source of potential duplicate name generation. If there is no prefix, a global prefix with a global counter is used. Just to be sure.
If everything is as it should be, a counter per parent control is used as you suggested.
Code:
NoThankYou.lua:
local panel = LAM:RegisterAddonPanel("NOTY_Panel", panelData)

LibAddonMenu-2.0.lua:
function lam:RegisterAddonPanel(addonID, panelData)
    local panel = lamcc.panel(nil, panelData, addonID)    --addonID==global name of panel

panel.lua:
function LAMCreateControl.panel(parent, panelData, controlName)
    local control = wm:CreateTopLevelWindow(controlName)
As you can see, panel must have global name (addonID). So, code which I have posted before will create combobox with name "NOTY_PanelCombobox1". Is anything wrong with this name?
  Reply With Quote