MyFrame_Update is creating new FontStrings each scroll on top of the ones before.
Create the Fontstrings in CreateRow() so they only get created once
Code:
f.DKPInfo[i].Text1 = f.DKPInfo[i]:CreateFontString(nil, "OVERLAY");
...
f.DKPInfo[i].Text2 = f.DKPInfo[i]:CreateFontString(nil, "OVERLAY");
...
f.DKPInfo[i].Text3 = f.DKPInfo[i]:CreateFontString(nil, "OVERLAY");
In MyFrame_Update() just set the new text to the three FontString for that row
Code:
row.DKPInfo[1].Text1:SetText(...)
row.DKPInfo[1].Text2:SetText(...)
row.DKPInfo[1].Text3:SetText(...)
Create and Update would look more like
Code:
function CreateRow(parent, id) -- Create 3 buttons for each row in the list
local f = CreateFrame("Button", "$parentLine"..id, parent)
f.Strings = {}
f:SetSize(core.TableWidth, core.TableHeight)
f:SetHighlightTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp");
f:SetScript("OnClick", OnClick)
for i=1, 3 do
f.Strings[i] = f:CreateFontString(nil, "OVERLAY");
f.Strings[i]:SetFontObject("GameFontHighlight");
f.Strings[i]:SetTextColor(1, 1, 1, 1);
end
f.Strings[1]:SetPoint("LEFT")
f.Strings[2]:SetPoint("CENTER")
f.Strings[3]:SetPoint("RIGHT", -30, 0)
return f
end
function MyFrame_Update(self)
local numOptions = #TableData
local index, row
local offset = FauxScrollFrame_GetOffset(self)
for i=1, core.TableNumrows do
row = self.Rows[i]
index = offset + i
if (index == SelectedData) then
row:SetNormalTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2.blp")
else
row:SetNormalTexture(nil)
end
if TableData[index] then
row.Strings[1]:SetText("Player"..TableData[index].player)
row.Strings[2]:SetText(classes[TableData[index].class])
row.Strings[3]:SetText(TableData[index].dkp)
else
row:Hide()
end
end
FauxScrollFrame_Update(self, numOptions, numrows, height)
end
I didn't put a lot of thought into positioning the FontStrings