View Single Post
05-16-21, 06:55 AM   #4
Darkonode
A Murloc Raider
 
Darkonode's Avatar
Join Date: May 2021
Posts: 8
Thank you so much thus far for helping me. You've helped me quite a bit!

Originally Posted by Fizzlemizz View Post
...
Without looking at anything it points out that your missing a "then" in config.lua at:

if (SelectedTab:GetID() ~= self:GetID())

and at:
Code:
local function SetTabs (frame numTabs, ...)
you're missing a , (comma) after frame

there may be others.
Oh.. my.. god.. it was literally this + another missing parenthesis and some parenting issues that i was able to spot after I slept overnight. I will deffo have a look at the debugging tools too!

Originally Posted by Xrystal View Post
The video is from 2014 which means alot of the code is way out of date and is likely the cause of the errors. Nearly every addon breaks when an expansion comes out every 2 or 3 years or a new feature is introduced during an expansion.

A quick look at the code you attached and init.lua looks like it may be fine. config.lua could have template frames that no longer exist. Have a look through Blizzards files to see what frames there are. You will find their frames defined for the most part if not all of them in the relative XML file.
https://www.townlong-yak.com/framexml/live

Shared Panel Template definitions - use this to find the names of the frames and their components
https://www.townlong-yak.com/framexm...lTemplates.xml


I would suggest looking at the tutorial section and browsing this site to see what is currently available.

https://wowpedia.fandom.com/wiki/Wow..._customization
...
I exported Blizzard code from the game client and have been using that as a reference for templates. I already had to make a change to some templates that mayron was using as they weren't present in the WoW classic client. Also I've noticed that not many addons use the default blizzard templates, at least not the ones that I use a lot and it has sometimes been tricky to find example usage of certain frames this way.

For my code right now, I managed to get it to show all the elements that I wanted. Now my problem is just in creating the tabs and attaching the content frame to the tab, which based on Mayron's code should be very simple but again I'm not sure what I'm doing wrong. I reckon the fault is in this function as the tabs won't even show on the main frame(?)
Code:
local function SetTabs (frame, numTabs, ...)
	frame.numTabs = numTabs
	local tabs = {}
	local frameName = frame:GetName()
	
	for i = 1, numTabs do
		local tab = CreateFrame("Button", frameName.."Tab"..i, frame, "CharacterFrameTabButtonTemplate")
		tab:SetID(i)
		tab:SetText(select(i, ...))
		tab.SetScript("OnClick", Tab_OnClick)
		
		tab.content = CreateFrame("Frame", nil, ConfigWin)
		tab.content:SetSize(600, 300)
		tab.content:SetPoint("CENTER", tab, "CENTER")
		tab.content:Hide()
		
		if (i == 1) then
			tab:SetPoint("TOPLEFT", ConfigWin, "BOTTOMLEFT", 5, 7)
		else
			tab:SetPoint("TOPLEFT", _G[frameName.."Tab"..(i-1)], "TOPRIGHT", -14, 0)
		end
		
	end
	
	Tab_OnClick(_G[frameName.."Tab1"])
	
	return unpack(tabs)
end
Updated config.lua attached.
Attached Files
File Type: lua config.lua (4.8 KB, 99 views)
  Reply With Quote