Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:Using UIDropDownMenu
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== HOWTO: nested submenu structures with UIDropDownMenu == If you want to split menus, this code examples may help you: -- creating test data structure local Test1_Data = { ["level1_test_1"] = { [1] = { ["name"] = "sublevel 1"; }, [2] = { ["name"] = "sublevel 2"; }, }, ["level1_test_2"] = { [1] = { ["name"] = "sublevel A"; }, [2] = { ["name"] = "sublevel B"; }, } } -- menu create function function Test1_DropDown_Initialize(self,level) level = level or 1; if (level == 1) then for key, subarray in pairs(Test1_Data) do local info = UIDropDownMenu_CreateInfo(); info.hasArrow = true; -- creates submenu info.notCheckable = true; info.text = key; info.value = { ["Level1_Key"] = key; }; UIDropDownMenu_AddButton(info, level); end -- for key, subarray end -- if level 1 if (level == 2) then -- getting values of first menu local Level1_Key = UIDROPDOWNMENU_MENU_VALUE["Level1_Key"]; subarray = Test1_Data[Level1_Key]; for key, subsubarray in pairs(subarray) do local info = UIDropDownMenu_CreateInfo(); info.hasArrow = false; -- no submenues this time info.notCheckable = true; info.text = subsubarray["name"]; -- use info.func to set a function to be called at "click" info.value = { ["Level1_Key"] = Level1_Key; ["Sublevel_Key"] = key; }; UIDropDownMenu_AddButton(info, level); end -- for key,subsubarray end -- if level 2 end -- function Test1_DropDown_Initialize To use the Menu, you can do local dropdown = CreateFrame("Frame", "Test_DropDown", UIParent, "UIDropDownMenuTemplate"); UIDropDownMenu_Initialize(dropdown, Test1_DropDown_Initialize, "MENU"); and you need something to active the menu, as with any menu ToggleDropDownMenu(1, nil, dropdown, self, -20, 0);
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)