View Single Post
04-26-23, 05:28 AM   #1
AeroMaxxD
An Aku'mai Servant
Join Date: Dec 2022
Posts: 33
Adding new tab to the character frame

I am looking to add a new tab to the character panel, I did some googling and found a post here which mentioned how to add a new tab to the collections journal which I have amended to add the tab to the character panel instead, except unfortunately it doesn't seem to work.

The code is as follows. Is there any error in this code somewhere? the game itself doesn't report any errors.

Code:
local TabName="MyNewTab";
 
local TabID=CharacterFrame.numTabs+1;
local Tab=CreateFrame("Button","$parentTab"..TabID,CharacterFrame,"CharacterFrameTab",TabID);
PanelTemplates_SetNumTabs(CharacterFrame,TabID);
Tab:SetPoint("LEFT","$parentTab"..(TabID-1),"RIGHT",-16,0);
Tab:SetText(TabName);
 
local Panel=CreateFrame("Frame",nil,CharacterFrame);
Panel:SetAllPoints(CharacterFrame);
 
hooksecurefunc("CharacterFrame_UpdateSelectedTab",function(self)
    local selected=PanelTemplates_GetSelectedTab(self);
    if selected==TabID then CharacterFrameTitleText:SetText(TabName); end
    Panel:SetShown(selected==TabID);
end);
  Reply With Quote