Hello guys I'm fairly new with lua and WOW API , i have created a panel with tabs but for some reasons the button texture is overlaping as seen in the image below.
below is my method that creates the buttons
Code:
local nextX = 0
function RaresKillTracker:CreateTab(expansion, tabCount)
local buttonHeight = 30
if not self.uiFrame then
print("Error: self.uiFrame is nil")
return nil
end
if not expansion then
print("Error: expansion is nil")
return nil
end
local tabButton = CreateFrame("Button", "TabButton" .. tabCount, self.uiFrame, "CharacterFrameTabButtonTemplate")
if not tabButton then
print("Error: Failed to create tabButton")
return nil
end
tabButton:SetText(expansion)
tabButton:SetHeight(buttonHeight)
tabButton:SetWidth(tabButton:GetTextWidth() + 20)
tabButton:SetPoint("BOTTOMLEFT", nextX, -28)
tabButton:UnlockHighlight()
nextX = nextX + tabButton:GetTextWidth() + 30
return tabButton
end
and here is my on click event
Code:
tabButton:SetScript("OnClick", function()
for _, frame in pairs(tabContentFrames) do
frame:Hide()
end
tabContentFrames[expansion]:Show()
tabButton:Disable()
for exp, btn in pairs(tabButtons) do
if exp ~= expansion then
btn:Enable()
end
end
self:UpdateZoneNPCs(zones[1].npcs)
local firstZoneButton = tabContentFrames[expansion]:GetChildren()
if firstZoneButton then
firstZoneButton:Disable()
end
for _, zbtn in pairs({tabContentFrames[expansion]:GetChildren()}) do
if zbtn ~= firstZoneButton then
zbtn:Enable()
end
end
end)