I create a dropdown controll and try to create it with this code
validChoices= BB.CharacterListe()
local dropdown = WINDOW_MANAGER:CreateControlFromVirtual(controlName.."ToonName", LeftFrame, "ZO_Options_Dropdown")
BB.dropdown=dropdown
dropdown:ClearAnchors()
dropdown:SetAnchor(TOP, toonlabel, BOTTOM, 0, 1)
dropdown:SetHidden(false)
dropdown.text = "Toon"
dropdown.valid = validChoices
local dropmenu = ZO_ComboBox_ObjectFromContainer(GetControl(dropdown, "Dropdown"))
ZO_PreHookHandler(dropmenu.m_selectedItemText, "OnTextChanged", function(self)
if dropmenu.m_selectedItemData then
selectedName = dropmenu.m_selectedItemData.name
dropmenu.m_selectedItemText.SetText(self, selectedName)
BB.SetToon(selectedName)
end
end)
dropdown:SetHandler("OnShow", function()
dropmenu:SetSelectedItem(validChoices)
end)
local function OnItemSelect(_, name, choice)
BB.SetToon(name)
end
for i=1,#validChoices do
local entry = dropmenu:CreateItemEntry(validChoices[i], OnItemSelect)
dropmenu:AddItem(entry)
end
|
i tried it with
or
local childs = dropdown.GetChildren()
for x, obj in pairs(childs) do
obj.SetWidth(100)
end
|
the last one raises a error, the other one has no effect.
Can anyone help me out, please.