View Single Post
02/22/15, 05:57 PM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
For the dropbox widget:

Lua Code:
  1. local countControl = parent
  2. local name = parent:GetName()
  3. if not name or #name == 0 then
  4.     countControl = LAMCreateControl
  5.     name = "LAM"
  6. end
  7. local comboboxCount = (countControl.comboboxCount or 0) + 1
  8. countControl.comboboxCount = comboboxCount
  9. control.combobox = wm:CreateControlFromVirtual(zo_strjoin(nil, name, "Combobox", comboboxCount), control, "ZO_ComboBox")
I do not fully understand this code. Why you just simply do not use panel name? All panels must have name. But you have to count with submenus, so:
Lua Code:
  1. local panel = parent.panel or parent

As I have written week ago in comments to LAM, simple and easy way is:
Lua Code:
  1. local panel = parent.panel or parent
  2. panel.comboboxCount = (panel.comboboxCount or 0) + 1
  3. control.combobox = wm:CreateControlFromVirtual(panel:GetName().."Combobox"..panel.comboboxCount, control, "ZO_ComboBox")
  Reply With Quote