Skip to content

Instantly share code, notes, and snippets.

@LenweSaralonde
Last active May 31, 2019 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LenweSaralonde/0d456400901e19916c77ee38c54eb8e3 to your computer and use it in GitHub Desktop.
Save LenweSaralonde/0d456400901e19916c77ee38c54eb8e3 to your computer and use it in GitHub Desktop.
EasyMenu to use with MSA-DropDownMenu
-- Simplified Menu Display System
-- This is a basic system for displaying a menu from a structure table.
--
-- See UIDropDownMenu.lua for the menuList details.
--
-- Args:
-- menuList - menu table
-- menuFrame - the UI frame to populate
-- anchor - where to anchor the frame (e.g. CURSOR)
-- x - x offset
-- y - y offset
-- displayMode - border type
-- autoHideDelay - how long until the menu disappears
--
--
function MSA_EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay )
if ( displayMode == "MENU" ) then
menuFrame.displayMode = displayMode;
end
MSA_DropDownMenu_Initialize(menuFrame, MSA_EasyMenu_Initialize, displayMode, nil, menuList);
MSA_ToggleDropDownMenu(1, nil, menuFrame, anchor, x, y, menuList, nil, autoHideDelay);
end
function MSA_EasyMenu_Initialize( frame, level, menuList )
for index = 1, #menuList do
local value = menuList[index]
if (value.text) then
value.index = index;
MSA_DropDownMenu_AddButton( value, level );
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment