WoW:API EasyMenu: Difference between revisions

767 bytes added ,  22 September 2009
m
→‎Examples: fix comment
m (catfix, Replaced: {{framexml → <br>{{framexml)
m (→‎Examples: fix comment)
Line 9: Line 9:
:;menuList : Table (see [[#Details|Details]])
:;menuList : Table (see [[#Details|Details]])
:;menuFrame : the UI frame to populate.
:;menuFrame : the UI frame to populate.
:;anchor : Just like in the [[UIOBJECT_GameTooltip|GameTooltip]] this is the anchor point
:;anchor : Just like in the [[UIOBJECT_GameTooltip|GameTooltip]] this is the anchor point.
:;x : X position.
:;x : X position.
:;y : Y position.
:;y : Y position.
Line 34: Line 34:
== Notes ==
== 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.
* 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.
==Examples==
local menu_frame = CreateFrame("Frame", "ExampleMenuFrame", UIParent, "UIDropDownMenuTemplate")
local function onOption1()
  -- do stuff
end
local function onOption2()
  -- do stuff
end
local menuList = {
  { text = "Option 1", func = onOption1 },
  { text = "Option 2", func = onOption2 }
}
menu_frame:SetPoint("Center", UIParent, "Center") -- setup position of menu. Not needed if 'cursor' is used as anchor in EasyMenu
EasyMenu(menuList, menuFrame, "ExampleMenuFrame", 0 , 0, "MENU")
Above example creates "MENU" type poupup menu (see [[HOWTO: Use UIDropDownMenu]]).
To crate standard menu:
local menu_frame = CreateFrame("Frame", "ExampleMenuFrame", UIParent)
...
EasyMenu(menuList, menuFrame, "ExampleMenuFrame", 0 , 0)


== See Also ==  
== See Also ==  
*[[UI Object UIDropDownMenu]]
*[[UI Object UIDropDownMenu]]
*[[HOWTO: Use UIDropDownMenu]]
*[[HOWTO: Use UIDropDownMenu]]
Anonymous user