Hello, I am trying to create a dropdown menu using this tutorial
http://wow.gamepedia.com/Using_UIDropDownMenu
But instead of having in on UIParent, I want to stick it inside my addon frame.
Here's my code, i changed 'UIParent' to 'Main' (my frame) as 3rd argument but the list is still drawn on on parent. I tried I to write 'Main:CreateFrame...' but the dropdown list dissapears completely.
lua Code:
raids = {'Naxxramas','Vault of Archavon','Obsidian Sanctum','Ulduar','The Eye of Eternity','Trial of the Crusader','Onyxia\'s Lair','Icecrown Citadel','Ruby Sanctum'}
raid_values ={'naxx','voa','os','uldu','eoe','toc','onyxia','icc','rs'}
local raid;
local dropDown = CreateFrame("Frame", "raidDrop", Main, "UIDropDownMenuTemplate")
dropDown:SetPoint("CENTER",0,0)
UIDropDownMenu_SetWidth(dropDown, 80)
UIDropDownMenu_SetText(dropDown,raid)
UIDropDownMenu_Initialize(dropDown, function(self, level, menuList)
local info = UIDropDownMenu_CreateInfo()
for i=1,9 do
info.text, info.arg1, info.checked = raids[i], raid_values[i], false
info.func = self.SetValue
UIDropDownMenu_AddButton(info)
end
end)
function dropDown:SetValue(newValue)
raid = newValue
UIDropDownMenu_SetText(dropDown,raid)
CloseDropDownMenus()
end