Thread Tools Display Modes
10-28-10, 04:25 PM   #1
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
simple frame not showing up

Hello community, I welcome thy to mine first post... Lol

Anyways. Trying to just make a simple frame / window / panel thing in WoW...
My god theres no tutorials barely out there... I am just trying to make a simple frame popup for now... (I swear if I can ever learn this I'll me making a tutorial... ugh)

Anyways, heres what I got...
Code:
SK = {}
function SK.Events(frame, event, ...)
	if (event == "ADDON_LOADED") then
		SK.Frame:Show()
	end
end
SK.Frame = CreateFrame("Frame", "SK Test", UIParent)
SK.Frame:SetFrameStrata("TOOLTIP")
SK.Frame:SetWidth(300)
SK.Frame:SetHeight(300)
SK.Frame:SetPoint("CENTER",0,0)
SK.Frame:SetScript("OnEvent", SK.Events)
SK.Frame:RegisterEvent("ADDON_LOADED")
So what am I doing wrong? Cause I get nothing. No errors or anything.

EDIT: Couple stupid little errors... Sigh

Last edited by samishii23 : 10-28-10 at 04:35 PM.
  Reply With Quote
10-28-10, 04:41 PM   #2
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Your frame is shown but it doesn't contain anything, try adding a background and have a look again

Code:
local backdrop = {
 bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
 edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
 tile = true,
 tileSize = 16,
 edgeSize = 16,
 insets = { left = 4, right = 4, top = 4, bottom = 4 }
}
SK.Frame:SetBackdrop(backdrop)
Also when you register ADDON_LOADED it will also fire for every addon that loads after yours so you might want to unregister it after you're done.

Code:
SK.Frame:UnregisterEvent("ADDON_LOADED")
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
10-28-10, 04:56 PM   #3
samishii23
An Aku'mai Servant
Join Date: Oct 2010
Posts: 33
Ah, neat on the Backdrop portion.
Will need to read up on that.
Thanks for the help!
  Reply With Quote
10-28-10, 08:00 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by v6o View Post
Also when you register ADDON_LOADED it will also fire for every addon that loads after yours so you might want to unregister it after you're done.
Also, you may wish to check that it fired for your addon. In addition, the first argument (which you named frame) passed to your SK.Events function is a reference to the frame which was registered for the event and triggered the script. Since that frame is the same as that which you wish to be shown, then you can just use that variable as reference instead.
Code:
function SK.Events(frame, event, arg1, ...)
	if (event == "ADDON_LOADED") and arg1 == "SKAddonName" then
		frame:Show()
		frame:UnregisterEvent("ADDON_LOADED")
	end
end

Lastly, there are plenty of tutorials about, though some of them may be a bit out of date with some recent API changes. Google should be able to find you some, as well as the sticky at the top of the Tutorials & Other Helpful Info section in this forum.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » simple frame not showing up

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