WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Add another Button into the Blizzard Game Menu (https://www.wowinterface.com/forums/showthread.php?t=57642)

Noresa 10-29-19 02:44 PM

Add another Button into the Blizzard Game Menu
 
Hello Guys,

I want to learn about Addon creating and .lua. Recently I am trying to figure out how I simply add another Button to the Game Menu with different functions. For example open up a config Menu of another AddOn, or simply a little script to open the Character Panel for example.

I guess this all can be done with the functions and templates from the Blizzard GameMenuFrame.lua and the Button design can be pulled from "GameMenuButtonTemplate".

My problem is I don't know how to set it all together, I've done the basics with the resources I could find, like creating a Button, creating a Button that makes an Emote on Press, creating a panel etc.

Question is how can I get to the Game Menu and add a button there. Step 1 is finding out how to add it to the menu and after that is done, Step 2 I can do all the function things I want and play around further.

Any Advice would be great.

Regards


EDIT: Okay, got my fingers wet. So I've started with hiding the Help Button for my own Button, after that I created a frame and as a parentFrame I just gave the "GameMenuFrame". Played around a little and used a SetScript to do an Emote when pressing the button, but now I have to figure out how to close the Frame after pressing the button and how to open the frames I want.

Code Snippet:

Code:

GameMenuButtonHelp:Hide()

local frame = CreateFrame("Button","UIPanelButtonTemplateTest",
GameMenuFrame, "UIPanelButtonTemplate")
frame:SetHeight(20)
frame:SetWidth(145)
frame:SetText("Hello World Button")
frame:ClearAllPoints()
frame:SetPoint("TOP", 0, -30)
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", function()
        DoEmote("dance", UnitName("target"))
end )


erispope 10-30-19 07:30 AM

Most frames obey the Show/Hide convention.

You could try a simple mytrame:GetParent():Hide().


All times are GMT -6. The time now is 08:56 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI