View Single Post
08-19-22, 07:39 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
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:
  1. local function updateAchievementList() -- debug -- move to function section once working
  2.         local os = FauxScrollFrame_GetOffset(IronManInterfaceScrollFrame)
  3.         for index = 1, NumberList.scrollFrameNumberOfFrames do
  4.             local frame = IronManInterfaceScrollFrame.frames[index]
  5.             local offset = os + index
  6.             if offset <= #IronManCompleatedAchievements then
  7.                 local row = IronManInterfaceScrollFrame.frames[index]
  8.                 row.texture:SetTexture(IronManCompleatedAchievements[offset].icon)
  9.                 row.titleTextBox.text:SetText(IronManCompleatedAchievements[offset].title)
  10.                 row.frameNameTextBox.text:SetText(IronManCompleatedAchievements[offset].char)
  11.                 row.frameDateTextBox.text:SetText(IronManCompleatedAchievements[offset].date)
  12.                 row:Show()
  13.             else
  14.                 row:Hide()
  15.             end
  16.         end
  17.         FauxScrollFrame_Update(IronManInterfaceScrollFrame, #IronManCompleatedAchievements, NumberList.scrollFrameNumberOfFrames, NumberList.scrollFrameRowHeight);
  18.     end
  19.      
  20.     local IronManInterfaceScrollParent =
  21.         CreateFrame("Frame", "IronManInterfaceScrollParent", IronManInterfaceFrame, "HelpFrameContainerFrameTemplate")
  22.     IronManInterfaceScrollParent:SetSize(NumberList.scrollParentWidth, NumberList.scrollParentHeight)
  23.     IronManInterfaceScrollParent:SetPoint(
  24.         "TOP",
  25.         IronManInterfaceFrame,
  26.         "TOP",
  27.         NumberList.scrollParentGapX,
  28.         NumberList.scrollParentTopGap
  29.     )
  30.      
  31.     local IronManInterfaceScrollFrame =
  32.         CreateFrame("ScrollFrame", "IronManInterfaceScrollFrame", IronManInterfaceScrollParent, "FauxScrollFrameTemplate")
  33.     IronManInterfaceScrollFrame:SetPoint("TOPLEFT", 0, -8)
  34.     IronManInterfaceScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  35.     IronManInterfaceScrollFrame:SetScript(
  36.         "OnVerticalScroll",
  37.         function(self, offset)
  38.             FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.scrollFrameRowHeight, updateAchievementList)
  39.         end
  40.     )
  41.      
  42.     IronManInterfaceScrollFrame.frames = {}
  43.     for index = 1, NumberList.scrollFrameNumberOfFrames do
  44.         IronManInterfaceScrollFrame.frames[index] =
  45.             CreateFrame("Frame", "IMISF" .. index, IronManInterfaceScrollParent, "HelpFrameContainerFrameTemplate")
  46.         local frame = IronManInterfaceScrollFrame.frames[index]
  47.         frame:SetSize(NumberList.scrollFrameRowWidth, NumberList.scrollFrameRowHeight)
  48.         frame:SetPoint("TOPLEFT", 5, -(index - 1) * NumberList.scrollFrameRowHeight - 5)
  49.      
  50.         frame.texture = frame:CreateTexture("frametexture"..index)
  51.         frame.texture:SetScale(NumberList.iconAchievementTextureScale)
  52.         frame.texture:SetPoint("LEFT")
  53.      
  54.         frame.titleTextBox = CreateFrame("Frame", "frametitleTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
  55.         frame.titleTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
  56.         frame.titleTextBox:SetPoint("TOPRIGHT")
  57.      
  58.         frame.titleTextBox.text = frame.titleTextBox:CreateFontString("frametitleTextBoxtext"..index)
  59.         frame.titleTextBox.text:SetAllPoints(frame.titleTextBox)
  60.         frame.titleTextBox.text:SetFontObject(FontList.rulesFont)
  61.      
  62.         frame.frameNameTextBox = CreateFrame("Frame", "frameNameTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
  63.         frame.frameNameTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
  64.         frame.frameNameTextBox:SetPoint("RIGHT")
  65.      
  66.         frame.frameNameTextBox.text = frame.frameNameTextBox:CreateFontString("frameNameTextBoxtext"..index)
  67.         frame.frameNameTextBox.text:SetAllPoints(frame.frameNameTextBox)
  68.         frame.frameNameTextBox.text:SetFontObject(FontList.rulesFont)
  69.      
  70.         frame.frameDateTextBox = CreateFrame("Frame", "frameDateTextBox"..index, frame, "HelpFrameContainerFrameTemplate")
  71.         frame.frameDateTextBox:SetSize(NumberList.scrollAchievementTextBoxWidth, NumberList.scrollAchievementTextBoxHeight)
  72.         frame.frameDateTextBox:SetPoint("BOTTOMRIGHT")
  73.      
  74.         frame.frameDateTextBox.text = frame.frameDateTextBox:CreateFontString("frameDateTextBoxtext"..index)
  75.         frame.frameDateTextBox.text:SetAllPoints(frame.frameDateTextBox)
  76.         frame.frameDateTextBox.text:SetFontObject(FontList.rulesFont)
  77.     end
  78.     updateAchievementList()
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-19-22 at 12:30 PM.
  Reply With Quote