Thread Tools Display Modes
08-21-24, 12:09 PM   #1
chamling
A Defias Bandit
Join Date: Aug 2024
Posts: 3
Adding item in menu after character right click

Hi,
I'm new to wow addon development and I'm trying to add items in the menu which shows up after right click on character Icon/focus like raider.io has.
I have no clue where to start and didn't find any useful information.
Attached Images
File Type: png Screenshot 2024-08-21 110722.png (533.7 KB, 6 views)
  Reply With Quote
08-21-24, 02:00 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,974
I posted this somewhere else as an example of changing the player (SELF) unit menu but...

So here 'tis again.

/tst to toggle wether the menu adds the entries at the top.
Lua Code:
  1. local XXX
  2.  
  3. Menu.ModifyMenu("MENU_UNIT_SELF", function(ownerRegion, rootDescription, contextData)
  4.     -- Append a new section to the end of the menu.
  5.     rootDescription:CreateDivider()
  6.     rootDescription:CreateTitle("My New End Section")
  7.     rootDescription:CreateButton("|TInterface\\ICONS\\ClassIcon_Evoker:16:16|t Appended button", function() print("Clicked the appended button!") end)
  8. -- Create a button to be a flyout sub-menu
  9.     local submenu = rootDescription:CreateButton("Sub-Menu")
  10. -- adding these buttons makes submenu a flyout
  11.     submenu:CreateButton("Enable", function(self)
  12.         print("Click Enable")
  13.     end)
  14.     submenu:CreateButton("Disable", function(self)
  15.         print("Click Disable")
  16.     end)
  17.  
  18.     -- Insert a new section at the start of the menu.
  19.     if XXX then
  20.         local title = MenuUtil.CreateTitle("My New Top Section")
  21.         rootDescription:Insert(title, 1)
  22.         local button = MenuUtil.CreateButton("Top button", function() print("Clicked the inserted button!") end)
  23.         rootDescription:Insert(button, 2)
  24.         local divider = MenuUtil.CreateDivider()
  25.         rootDescription:Insert(divider, 3)
  26.     end
  27. end)
  28.  
  29. SLASH_TESTMENU1 = "/tst" -- toggle hiding/showing top menu insert
  30. SlashCmdList.TESTMENU = function(msg)
  31.     XXX = not XXX
  32. end

Change: "MENU_UNIT_SELF" to "MENU_UNIT_TARGET" to change the menu for a target unit NPC or see the code
in the TargetFrame_OpenMenu function to see the other target menu options.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-21-24 at 03:23 PM.
  Reply With Quote
08-22-24, 06:58 PM   #3
chamling
A Defias Bandit
Join Date: Aug 2024
Posts: 3
Ty so much this is what i was looking for.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Adding item in menu after character right click


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off