m
→Examples: yank howto link; it's also in see also
m (→Examples: fix comment) |
m (→Examples: yank howto link; it's also in see also) |
||
| Line 1: | Line 1: | ||
{{framexmlfunc|FrameXML/EasyMenu.lua}} | |||
Easily create context menus on the fly with clickable items. | Easily create context menus on the fly with clickable items. | ||
EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay) | EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay) | ||
==Arguments== | ==Arguments== | ||
;menuList : Table - see [[#Details|Details]] for key/value descriptions. | |||
;menuFrame : Frame - the UI frame to populate. | |||
;anchor : String - Just like in the [[UIOBJECT_GameTooltip|GameTooltip]] this is the anchor point. | |||
;x : Number - x offset. | |||
;y : Number - y offset | |||
;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== | ==Details== | ||
;menuList : This needs to be a table in the following format. | |||
{ | { | ||
{ | { | ||
| Line 42: | Line 38: | ||
-- do stuff | -- do stuff | ||
end | end | ||
local function onOption2() | local function onOption2() | ||
-- do stuff | -- do stuff | ||
| Line 55: | Line 50: | ||
EasyMenu(menuList, menuFrame, "ExampleMenuFrame", 0 , 0, "MENU") | EasyMenu(menuList, menuFrame, "ExampleMenuFrame", 0 , 0, "MENU") | ||
Above example creates "MENU" type poupup menu | Above example creates "MENU" type poupup menu. | ||
To crate standard menu: | To crate standard menu: | ||
local menu_frame = CreateFrame("Frame", "ExampleMenuFrame", UIParent) | local menu_frame = CreateFrame("Frame", "ExampleMenuFrame", UIParent) | ||
| Line 62: | Line 57: | ||
== See Also == | == See Also == | ||
*[[UI Object UIDropDownMenu]] | * [[UI Object UIDropDownMenu]] | ||
*[[ | * [[Using UIDropDownMenu]] | ||