WoW:API EasyMenu: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (New page: {{wowapi}} Easily create context menus on the fly with clickable items. EasyMenu(menuItems, template, anchor, unknown, unknown, strata) ==Arguments== :(menuItems, template, anchor, unk...)
 
Line 29: Line 29:
     -- ...
     -- ...
  }
  }
:See "List of button attributes" in the [[FrameXML]] file ''UIDropDownMenu.lua'' for the full list of available table elements.


== Notes ==
== Notes ==
* The menu becomes visible as soon as you call the function and goes away after you click a menu item.
* 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.
 
== See Also ==
*[[UI Object UIDropDownMenu]]
*[[HOWTO: Use UIDropDownMenu]]

Revision as of 21:08, 11 May 2008

WoW API < EasyMenu

"I" iconThis function is implemented in Lua here FrameXML/EasyMenu.lua.

Easily create context menus on the fly with clickable items.

EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)

Arguments

(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay)
menuList
Table (see Details)
menuFrame
the UI frame to populate.
anchor
Just like in the GameTooltip this is the anchor point
x
X position.
y
Y position.
displayMode
The display mode. Usually "MENU".
autoHideDelay
Automatically hide the menu after this many seconds.

Details

menuList
This needs to be a table in the following format.
{
    {
        text = "Menu Item 1", -- string. This is the text to put on this menu item.
        func = function() DoStuff() end, -- function. This is the function that will fire when you click on this menu item.
    },
    {
        text = "Menu Item 2",
        func = function() DoOtherStuff() end,
    },
    -- ...
}
See "List of button attributes" in the FrameXML file UIDropDownMenu.lua for the full list of available table elements.

Notes

  • 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.

See Also