WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Working on updating my UI (https://www.wowinterface.com/forums/showthread.php?t=59104)

Kupotek 04-21-22 12:52 AM

Working on updating my UI
 
Hello, I'm the author of longtime game UI, Panther, right here on Wowinterface since 2008... I came back to WOW after a few years and am running into a few errors I'm hoping someone can help me fix as I hope to release a new version of the UI soon.

1. In my welcome screen bugsack is giving me a SetBackdrop error, this is the code in my welcome screen addon:

f:SetBackdrop( { bgFile="Interface\\Addons\\DialogFrame\\Smoke", insets={left=4,right=4,top=4,bottom=4}, tileSize=16, tile=false, edgeFile="Interface\\Addons\\DialogFrame\\Border", edgeSize = 8 } )

THE ERROR ITSELF IS:

6x PantherWelcome\PantherWelcome.lua:13: attempt to call method 'SetBackdrop' (a nil value)
[string "@PantherWelcome\PantherWelcome.lua"]:13: in function <PantherWelcome\PantherWelcome.lua:8>

Locals:
(*temporary) = nil
(*temporary) = PantherWelcome {
0 = <userdata>
}
(*temporary) = <table> {
bgFile = "Addons\DialogFrame\Smoke"
tileSize = 16
tile = false
edgeSize = 8
edgeFile = "Addons\DialogFrame\Border"
insets = <table> {
}
}
(*temporary) = "attempt to call method 'SetBackdrop' (a nil value)"
f = PantherWelcome {
0 = <userdata>
}

Fizzlemizz 04-21-22 01:09 AM

Every frame used to have a backdrop if it was needed or not. Now they are optional (at least in retail, I don't think change has been backported to the classics yet but...?).

In retail, your frames that require backdrops can inherit the the new BackdropTemplate

Code:

<Frame name="somename" inherits="BackdropTemplate">
    ...
</Frame>


Code:

local f = CreateFrame("Frame", "somename", UIParent, "BackdropTemplate")
and if you want to add a backdrop to a frame that has already been created but hasn't interited the template then you can add the backdrop mixin (code) before setting the backdrop
Code:

if not frame.SetBackdrop then
  Mixin(frame, BackdropTemplateMixin)
end
frame:SetBackdrop(...)


Kupotek 04-21-22 01:28 AM

Can you help if I post the addon's code?

Quote:

PantherWelcomeShow = true -- savedvar

local f = CreateFrame("Frame","PantherWelcome",UIParent)
f:RegisterEvent("PLAYER_LOGIN")


f:SetFrameStrata("dialog")
f:SetScript("OnEvent",function()
if PantherWelcomeShow then
-- main background frame (you can apply your blue border to this backdrop)
f:SetSize(400,350)
f:SetPoint("CENTER")
f:SetBackdrop( { bgFile="Interface\\Addons\\DialogFrame\\Smoke", insets={left=4,right=4,top=4,bottom=4}, tileSize=16, tile=false, edgeFile="Interface\\Addons\\DialogFrame\\Border", edgeSize = 8 } )
-- logo to left
f.image = f.image or f:CreateTexture(nil,"ARTWORK")
f.image:SetSize(150,150)
f.image:SetPoint("LEFT",8,0)
f.image:SetTexture("Interface\\Addons\\DialogFrame\\Border-Cat-Round2")
-- title at top
f.title = f.title or f:CreateFontString(nil,"ARTWORK","GameFontNormalLarge")
f.title:SetPoint("TOP",0,-16)
f.title:SetText("Panther")
f.title:SetFont("Interface\\AddOns\\SharedMedia_MyMedia\\font\\BlackChancery.ttf", 20)
-- place to put a paragraph or two of text
f.text = f.text or f:CreateFontString(nil,"ARTWORK","GameFontHighlight")
f.text:SetPoint("TOPRIGHT",-32,-42)
f.text:SetPoint("BOTTOMRIGHT",-32,42)
f.text:SetPoint("LEFT",f.image,"RIGHT",16,0)
f.text:SetJustifyH("LEFT")
f.text:SetText("Welcome to Panther UI v.15.0\n\n04/21/2022\n\nŠ 2008-2022\n\nDarwinsradio - Area 52\n\nI am so happy you decided to try my UI.\n\nIf you are having any problems, post a comment at Wowinterface or email me at \n\n-Jonathan")
-- checkbutton in bottomleft
f.prompt = f.prompt or CreateFrame("CheckButton",nil,f,"UICheckButtonTemplate")
f.prompt:SetPoint("BOTTOMLEFT",12,10)
f.prompt.text:SetText("Don't show this again")
f.prompt.text:SetFontObject("GameFontHighlightSmall")
-- okay button
f.okay = f.okay or CreateFrame("Button",nil,f,"UIPanelButtonTemplate")
f.okay:SetSize(96,22)
f.okay:SetPoint("BOTTOMRIGHT",-12,12)
f.okay:SetText(OKAY)
-- when okay clicked, set savedvar to whether prompt not checked and hide window
f.okay:SetScript("OnClick",function(self)
local parent = self:GetParent()
PantherWelcomeShow = not parent.prompt:GetChecked()
parent:Hide()
end)
end
end)

Fizzlemizz 04-21-22 01:33 AM

Lua Code:
  1. local f = CreateFrame("Frame","PantherWelcome",UIParent, "BackdropTemplate")

Kupotek 04-21-22 01:39 AM

I thought that might be part of it, didn't realize that's it! Thanks! so much.


All times are GMT -6. The time now is 10:24 AM.

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