Open main menu
Home
Random
Log in
Settings
About AddOn Studio
Disclaimers
AddOn Studio
Search
Editing
WoW:API EasyMenu
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!
{{framexmlfunc|FrameXML/EasyMenu.lua}} __NOTOC__ Populate a context menu with options described in a provided table. EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay) ==Arguments== ;menuList : Table - an array of tables describing the entries in the menu to be created. The descriptions may use any key-value tables used in a [[UI_Object_UIDropDownMenu#The_info_table|UIDropDownMenu info table]]; as a bare minimum, each option should specify the "text" key. ;menuFrame : Frame - a Frame object that will be used to store some information about the menu. ;anchor : String/Region - Specify what to anchor the menu relative to: either "cursor", a region name, or a region (frame) reference. ;x : Number - x offset from the anchor. ;y : Number - y offset from the anchor. ;displayMode : String - "MENU" enables a tooltip-styled context menu, any other value the dropdown style. ;autoHideDelay : Number - Automatically hide the menu after this many seconds. == Details == * The menu becomes visible as soon as you call the function and goes away after you click a menu item unless keepShownOnClick in '''menuList''' was set to 1. * Fine-grained control over the positioning of the menu is possible by setting the menuFrame.point and menuFrame.relativePoint values to specific anchor points to use when anchoring the frame to a non-cursor region. ==Example== The following example creates a context menu based on a table description: local menu = { { text = "Select an Option", isTitle = true}, { text = "Option 1", func = function() print("You've chosen option 1"); end }, { text = "Option 2", func = function() print("You've chosen option 2"); end }, { text = "More Options", hasArrow = true, menuList = { { text = "Option 3", func = function() print("You've chosen option 3"); end } } } } local menuFrame = CreateFrame("Frame", "ExampleMenuFrame", UIParent, "UIDropDownMenuTemplate") -- Make the menu appear at the cursor: EasyMenu(menu, menuFrame, "cursor", 0 , 0, "MENU"); -- Or make the menu appear at the frame: menuFrame:SetPoint("Center", UIParent, "Center") EasyMenu(menu, menuFrame, menuFrame, 0 , 0, "MENU"); ==Notes== * You <i>must</i> give the frame a name (argument 2 to {{api|CreateFrame}}()) for menus to work. == See Also == * [[UI Object UIDropDownMenu]] * [[Using UIDropDownMenu]]
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)
Templates used on this page:
Template:Api
(
edit
)
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Framexml
(
edit
)
Template:Framexmlfunc
(
edit
)
Template:Icon-information
(
edit
)
Template:Wowapi
(
edit
)
Template:Wowtoolsfilelink
(
edit
)
Close
Loading editor…