Posted by nibs on Sat, 24 Nov 2012 05:44:38
I'm trying create a button to use my hearthstone. The top section of code creates a frame and displays some artwork on the screen. the second chunk is supposed to create another frame and a button to go with it. I can get it to show up on the screen, but it takes up the ENTIRE screen. A while back I got some help on this forum and coded it in KgPanels, but now I'm trying to do it in my own addon. I tried to transfer over most of the code that i thought was relevant. The button works no matter where i click on it. If you can not only show me what i'm doing wrong but give me a brief explanation about why what I did was wrong that would really help me out in the future. Also I can't get the code to print as it is supposed to line by line without putting and extra line in between. Some direction on properly posting code would be great as well. Thanks!
CreateFrame("Frame", "NibsMain", UIParent)
NibsMain:SetPoint("BOTTOM", UIParent, "CENTER")
NibsMain.Border = NibsMain:CreateTexture("NibsMain.Border", "BACKGROUND")
NibsMain.Border:SetPoint("BOTTOM", NibsMain, "BOTTOM")
Hearth = CreateFrame("Button", "Hearth", UIParent, "SecureActionButtonTemplate")
Hearth:SetPoint("CENTER", UIParent, "CENTER")
Posted by jnwhiteh on Fri, 30 Nov 2012 05:23:18
The issue is
Hearth:SetAllPoints(), which sets Hearth to be the same size as the parent frame. That's obviously not what you want, since you anchor it explicitly a few lines earlier.
Posted by nibs on Fri, 30 Nov 2012 18:54:27
Ahh you're right. Thanks.