Your row creation process is not doing what you think it is and and because of that, neither is the row assigment code in updateAchievementList(). That's part of what's messing things up. Also missing the updateAchievementList() call after the frame is created (assuming the source table is loaded at that stage??)
Each row should create unique elements with unique names (if you're using them) and you should add the sub-elements to each rows "main" frame. That's what you use in the update function when you get the offset entry in IronManCompleatedAchievements table that row (IronManInterfaceScrollFrame.frames[index]) corresonds to .
I think this should work based on the code you posted so long as the information in the NumberList table matches what I think it is (just guessing as that wasn't supplied but it's important to the FauxScrollFrame_Update function).
Lua Code:
local function updateAchievementList() -- debug -- move to function section once working
local os = FauxScrollFrame_GetOffset(IronManInterfaceScrollFrame)
for index = 1, NumberList.scrollFrameNumberOfFrames do
local frame = IronManInterfaceScrollFrame.frames[index]
local offset = os + index
if offset <= #IronManCompleatedAchievements then
local row = IronManInterfaceScrollFrame.frames[index]
row.texture:SetTexture(IronManCompleatedAchievements[offset].icon)
row.titleTextBox.text:SetText(IronManCompleatedAchievements[offset].title)
row.frameNameTextBox.text:SetText(IronManCompleatedAchievements[offset].char)
row.frameDateTextBox.text:SetText(IronManCompleatedAchievements[offset].date)
row:Show()
else
row:Hide()
end
end
FauxScrollFrame_Update(IronManInterfaceScrollFrame, #IronManCompleatedAchievements, NumberList.scrollFrameNumberOfFrames, NumberList.scrollFrameRowHeight);
end
local IronManInterfaceScrollParent =
CreateFrame("Frame", "IronManInterfaceScrollParent", IronManInterfaceFrame, "HelpFrameContainerFrameTemplate")
IronManInterfaceScrollParent:SetSize(NumberList.scrollParentWidth, NumberList.scrollParentHeight)
IronManInterfaceScrollParent:SetPoint(
"TOP",
IronManInterfaceFrame,
"TOP",
NumberList.scrollParentGapX,
NumberList.scrollParentTopGap
)
local IronManInterfaceScrollFrame =
CreateFrame("ScrollFrame", "IronManInterfaceScrollFrame", IronManInterfaceScrollParent, "FauxScrollFrameTemplate")
IronManInterfaceScrollFrame:SetPoint("TOPLEFT", 0, -8)
IronManInterfaceScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
IronManInterfaceScrollFrame:SetScript(
"OnVerticalScroll",
function(self, offset)
FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.scrollFrameRowHeight, updateAchievementList)
end
)
IronManInterfaceScrollFrame.frames = {}
for index = 1, NumberList.scrollFrameNumberOfFrames do
IronManInterfaceScrollFrame.frames[index] =
CreateFrame("Frame", "IMISF" .. index, IronManInterfaceScrollParent, "HelpFrameContainerFrameTemplate")
local frame = IronManInterfaceScrollFrame.frames[index]
frame:SetSize(NumberList.scrollFrameRowWidth, NumberList.scrollFrameRowHeight)
frame:SetPoint("TOPLEFT", 5, -(index - 1) * NumberList.scrollFrameRowHeight - 5)
frame.texture = frame:CreateTexture("frametexture"..index)
frame.texture:SetScale(NumberList.iconAchievementTextureScale)
frame.texture:SetPoint("LEFT")
frame.titleTextBox = CreateFrame("Frame", "frametitleTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
frame.titleTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
frame.titleTextBox:SetPoint("TOPRIGHT")
frame.titleTextBox.text = frame.titleTextBox:CreateFontString("frametitleTextBoxtext"..index)
frame.titleTextBox.text:SetAllPoints(frame.titleTextBox)
frame.titleTextBox.text:SetFontObject(FontList.rulesFont)
frame.frameNameTextBox = CreateFrame("Frame", "frameNameTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
frame.frameNameTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
frame.frameNameTextBox:SetPoint("RIGHT")
frame.frameNameTextBox.text = frame.frameNameTextBox:CreateFontString("frameNameTextBoxtext"..index)
frame.frameNameTextBox.text:SetAllPoints(frame.frameNameTextBox)
frame.frameNameTextBox.text:SetFontObject(FontList.rulesFont)
frame.frameDateTextBox = CreateFrame("Frame", "frameDateTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
frame.frameDateTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
frame.frameDateTextBox:SetPoint("BOTTOMRIGHT")
frame.frameDateTextBox.text = frame.frameDateTextBox:CreateFontString("frameDateTextBoxtext"..index)
frame.frameDateTextBox.text:SetAllPoints(frame.frameDateTextBox)
frame.frameDateTextBox.text:SetFontObject(FontList.rulesFont)
end
updateAchievementList()