It worked great with that little extra change.
The downside is that it must overwrite the font sizes so gonna try and get it run after the addon is loaded and see how different it works. But first screen shot shows it working as follows:
edit:
Well combined your two posts into the following piece of code so that you could create multiple combo boxes ( dropdowns ) in the same Top Level Window.
Lua Code:
local wm = WINDOW_MANAGER
local choices1 = {"alpha","beta","gamma","delta","epsilon","zita","ita","theta","iota","kappa","lambda","mu","nu","omicron","pi","rho","sigma","tau","ipsilon","omega"}
local choices2 = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}
local function CreateTopLevelWindow(name)
local tlw = wm:CreateTopLevelWindow(name)
tlw:SetAnchor(CENTER)
tlw:SetDimensions(200, 50)
return tlw
end
local function CreateDropDown(name,parent,data,selected)
local combo = wm:CreateControlFromVirtual(parent:GetName()..name,parent,"ZO_StatsDropdownRow")
combo:SetAnchor(CENTER)
combo:GetNamedChild("Dropdown"):SetWidth(200)
combo.selected = combo.name
combo.selected:SetFont("ZoFontGameLarge")
combo.dropdown = combo.dropdown
combo.dropdown:SetFont("ZoFontGameLarge")
if selected then combo.dropdown:SetSelectedItem(selected) end
combo.dropdown.OnSelect = function(self,value)
self:SetSelectedItem(value)
end
for i = 1,#data do
local entry = combo.dropdown:CreateItemEntry(data[i],combo.dropdown.OnSelect)
combo.dropdown:AddItem(entry)
end
return combo
end
local function AddOnLoaded(eventID,addon)
if addon ~= "ZO_ComboBoxTest" then return end
EVENT_MANAGER:UnregisterForEvent(addon,eventID)
local testTLW = CreateTopLevelWindow("ZO_ComboBoxTest_TLW")
testTLW:SetDimensions(200,120)
local GreekAlphabet = CreateDropDown("GreekAlphabet",testTLW,choices1,"omega")
GreekAlphabet:SetAnchor(TOP)
local Weekdays = CreateDropDown("Weekdays",testTLW,choices2,"Sunday")
Weekdays:SetAnchor(BOTTOM)
end
EVENT_MANAGER:RegisterForEvent( "ZO_ComboBoxTest" ,EVENT_ADD_ON_LOADED , AddOnLoaded )
2nd picture shows the 2 together on the screen.
edit 3:
But as you can see, the font still isn't letting you change it for some reason. Maybe you would have to make a template of the template and change the fonts at that point. But no biggie.