Advertisement
Rochet2

AIO dropdown example

Nov 6th, 2014
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. -- Create button to show dropdown
  2. local Dropdownbutton = AIO:CreateFrame("Button", "Dropdownbutton", nil, "UIPanelButtonTemplate")
  3. Dropdownbutton:SetSize(100, 30)
  4. Dropdownbutton:SetPoint("CENTER")
  5.  
  6. -- Add on click handler
  7. Dropdownbutton:SetScript("OnClick", AIO:ToFunction("ToggleDropDownMenu(1, nil, Dropdownframe, Dropdownbutton, 0, 0)"))
  8.  
  9. -- Create the dropdown menu frame
  10. local Dropdownframe = AIO:CreateFrame("Frame", "Dropdownframe", Dropdownbutton, "UIDropDownMenuTemplate")
  11. Dropdownframe:SetPoint("CENTER", Dropdownbutton, "CENTER", 0, 50)
  12.  
  13. -- Initialize menu options through a function when sending menu
  14. local initmenu = [[
  15. UIDropDownMenu_Initialize(Dropdownframe,
  16. function()
  17.    info            = {};
  18.    info.text       = "This is an option in the menu.";
  19.    info.value      = "OptionVariable";
  20.    info.func       = function() print("Worked I guess") end
  21.              -- can also be done as function() FunctionCalledWhenOptionIsClicked() end;
  22.    
  23.    -- Add the above information to the options menu as a button.
  24.    UIDropDownMenu_AddButton(info);
  25. end
  26. , 'MENU')
  27. ]]
  28. Dropdownframe:AddBlock("Function", AIO:ToFunction(initmenu))
  29.  
  30. -- Now just send Dropdownbutton
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement