Thread Tools Display Modes
08-13-24, 10:18 PM   #1
Walkerbo
A Frostmaul Preserver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 271
Hover trees

Hi all

I want to create a hover tree similar to the right-click menu.

I am absolutely sure that hover tree is not an adequate description so I have attached an image to show what I mean.


I want to be able to hover over a title, and display a list of buttons.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-13-24, 10:49 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,975
It's a menu. 11.0 has a new system
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-15-24, 05:44 PM   #3
Walkerbo
A Frostmaul Preserver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 271
Hi Fizzlemizz

Sorry for my delayed response, I have been trying to get this working as required.

When we hover over the Add Friend button it displays a SubMenu of buttons.

The submenu example in the MenuImplementationGuide does not work correctly for me;

Lua Code:
  1. local submenu = rootDescription:CreateButton("My Submenu");
  2. submenu:CreateButton("Enable", SetEnabledFunction, true);
  3. submenu:CreateButton("Disable", SetEnabledFunction, false);
It creates a frame with the button tittle and displayed the buttons without hovering over the title.

What I want is to create either a button that displays a SubMenu on hover, or add extra buttons to the Add Friend submenu, or add a frame of buttons that is anchored to the Add Friend Submenu, (this last option is the one I would prefer).
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote
08-15-24, 08:07 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,975
It's all fairly new so a very basic example of what I think you want to do:
Lua Code:
  1. local f = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
  2. f:SetSize(80, 25)
  3. f:SetText("Click")
  4. f:SetPoint("TOP", -150, 0)
  5. f:SetScript("OnClick", function(self)
  6.     MenuUtil.CreateContextMenu(self, function(ownerRegion, rootDescription)
  7.         rootDescription:CreateTitle("Test Menu")
  8.         rootDescription:CreateButton("Button 1", function() print("Clicked button 1") end)
  9.         local submenu = rootDescription:CreateButton("Button 2")
  10.         submenu:CreateTitle("Test Sub-Menu")
  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.         rootDescription:CreateButton("Button 3", function() print("Clicked button 3") end)
  18.     end)
  19. end)
Creating submenu and adding buttons to it makes it a "flyout" sub-menu.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-16-24 at 02:40 AM.
  Reply With Quote
08-15-24, 09:41 PM   #5
Walkerbo
A Frostmaul Preserver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 271
Hi Fizzlemizz

Thanks for your example, it was exactly what I needed.

Lua Code:
  1. local menuButton1 = Menu.ModifyMenu("MENU_UNIT_SELF", function(_, menuButton)
  2.        menuButton:CreateDivider()
  3.        submenu = menuButton:CreateButton("Test")
  4.        submenu:CreateButton("Test Button 1", function(self)
  5.               print("ClickedTest Button 1")
  6.        end)
  7.        submenu:CreateButton("Test Button 2", function(self)
  8.               print("ClickedTest Button 2")
  9.        end)
  10. end)
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Hover trees

Thread Tools
Display Modes

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