Gaming
 

Talk:Using UIDropDownMenu

From WoWWiki

info.func format

Regarding the edit by IAmParadox made with the comment:

"I spent quite a while trying to get my dropdown to work correctly, and, if this page had the correct format for info.func, it would have taken much less time and hair pulling....)"

The format for info.func was not incorrect previously. Yes, you can define the function for info.func directly inside the table, but you can also have it point to another function by referring to it by name. Example:

 local function DoOption(arg)
   DEFAULT_CHAT_FRAME:AddMessage(arg);
 end
 
 local MyPopupMenu = {
   {
     text = "Option 1",
     func = DoOption,
     arg1 = "Option 1 clicked."
   },
   {
     text = "Option 2",
     func = function()  DEFAULT_CHAT_FRAME:AddMessage("Option 2 clicked.")  end;
   };
 };

Both ways give similar results. -- Tuhljin (talk) 23:49, 20 June 2008 (UTC)