Greetings!
I've hit a bit of a snag when it comes to generating comboboxes programatically.
I want to generate the contents of the box based on the contents of an array. I have everything working as far as the array goes, but when I try to generate the contents of the box, nothing shows up.
I took a look inside the xml that wow uid generates, and tried to copy that to a degree, hoping it would work. It did not, obviously.
Here is what wowuides generated:
Code:
local cb_init_fn = function()
local info
info = {}
info.text = "priest"
info.func = function() UIDropDownMenu_SetSelectedID(IntelliTargetFormTargetPanelddTarget1, this:GetID(), 0); UpdateTargetList("ddTarget1"); end
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_Initialize(this, cb_init_fn)
Here is what I tried to do:
Please note:
InitTable is a table populated with strings.
current is the name of the current drop down box being acted upon (I pass it around to do stuff)
DDID is the return of getglobal("IntelliTargetFormTargetPanel"..name) (where name is the name of the dropdown box)
Code:
function MakeButtons(DDID,current)
DEFAULT_CHAT_FRAME:AddMessage("calling makebuttons");
local i = 0;
for i = 1, table.getn(InitTable) do
DEFAULT_CHAT_FRAME:AddMessage("inside for: ".. InitTable[i]);
local info
info = {}
info.text = InitTable[i];
info.func = function()
UIDropDownMenu_SetSelectedID(DDID, this:GetID(), 0);
UpdateTargetList(current);
end
UIDropDownMenu_AddButton(info);
end
end
I get no errors when I run this, but I also get nothing in my dropdown box. Any ideas?
Thanks in advance!!