Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-15-22, 04:44 PM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Scrolling list of frames

Hi all

I want to have a scrolling frame that displays frames.

I have other scrolling lists of buttons and they work fine so I just thought I could repurpose it yet have not been able to get them working.

Here is the frame layout I want to build, it has 1 texture and 3 strings;


Here are the parent and child scroll frames;
Lua Code:
  1. local IronManInterfaceScrollParent =
  2.     CreateFrame("Frame", "IronManInterfaceScrollParent", IronManInterfaceFrame, "HelpFrameContainerFrameTemplate")
  3. IronManInterfaceScrollParent:SetSize(NumberList.achievementFrameWidth, 300)
  4. IronManInterfaceScrollParent:SetPoint("CENTER")
  5.  
  6. local IronManInterfaceScrollFrame = CreateFrame("ScrollFrame", "IronManInterfaceScrollFrame", IronManInterfaceScrollParent, "FauxScrollFrameTemplate")
  7. IronManInterfaceScrollFrame:SetPoint("TOPLEFT", 0, -8)
  8. IronManInterfaceScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
  9. IronManInterfaceScrollFrame:SetScript(
  10.     "OnVerticalScroll",
  11.     function(self, offset)
  12.         FauxScrollFrame_OnVerticalScroll(self, offset, NumberList.scrollFrameNumber, updateAchievementList)
  13.     end
  14. )

Here is my update function;
Lua Code:
  1. local function updateAchievementList()
  2.     FauxScrollFrame_Update(
  3.         IronManInterfaceScrollFrame,
  4.         #IronManCompleatedAchievements,
  5.         NumberList.scrollButtonNumber,
  6.         NumberList.scrollButtonHeight
  7.     )
  8.     for index = 1, NumberList.scrollButtonNumber do
  9.         local offset = index + FauxScrollFrame_GetOffset(IronManInterfaceScrollFrame)
  10.         local frame = IronManInterfaceScrollFrame.frames[index]
  11.         frame.index = offset
  12.         if offset <= #IronManCompleatedAchievements then
  13.             frametexture:SetTexture(IronManCompleatedAchievements[offset].icon)
  14.             frametitleTextBoxtext:SetText(IronManCompleatedAchievements[offset].title)
  15.             frameNameTextBoxtext:SetText(IronManCompleatedAchievements[offset].char)
  16.             frameDateTextBoxtext:SetText(IronManCompleatedAchievements[offset].date)
  17.             frame:Show()
  18.         else
  19.             frame:Hide()
  20.         end
  21.     end
  22. end

Here is my list of scroll list of frame builders;
Lua Code:
  1. IronManInterfaceScrollFrame.frames = {}
  2. for index = 1, NumberList.scrollFrameNumber do
  3.     IronManInterfaceScrollFrame.frames[index] =
  4.         CreateFrame("Frame", "IMISF" .. index, IronManInterfaceScrollParent, "HelpFrameContainerFrameTemplate")
  5.     local frame = IronManInterfaceScrollFrame.frames[index]
  6.     frame:SetSize(NumberList.scrollframeWidth, NumberList.scrollFrameHeight)
  7.     frame:SetPoint("TOPLEFT", 8, -(index - 1) * NumberList.scrollFrameHeight - 8)
  8.  
  9.     frame.texture = frame:CreateTexture("frametexture")
  10.     frametexture:SetScale(NumberList.iconAchievementTextureScale)
  11.     frametexture:SetPoint("LEFT")
  12.  
  13.     frame.titleTextBox = CreateFrame("Frame", "frametitleTextBox", frame)
  14.     frametitleTextBox:SetSize(350, 30) -- debug --
  15.     frametitleTextBox:SetPoint("TOPRIGHT")
  16.  
  17.     frametitleTextBox.text = frametitleTextBox:CreateFontString("frametitleTextBoxtext")
  18.     frametitleTextBoxtext:SetAllPoints(frametitleTextBox)
  19.     frametitleTextBoxtext:SetFontObject(FontList.rulesFont)
  20.  
  21.     frameNameTextBox = CreateFrame("Frame", "frameNameTextBox", frame)
  22.     frameNameTextBox:SetSize(350, 30) -- debug --
  23.     frameNameTextBox:SetPoint("CENTER")
  24.  
  25.     frameNameTextBox.text = frameNameTextBox:CreateFontString("frameNameTextBoxtext")
  26.     frameNameTextBoxtext:SetAllPoints(frameNameTextBox)
  27.     frameNameTextBoxtext:SetFontObject(FontList.rulesFont)
  28.  
  29.     frameDateTextBox = CreateFrame("Frame", "frameDateTextBox", frame)
  30.     frameDateTextBox:SetSize(350, 30) -- debug --
  31.     frameDateTextBox:SetPoint("CENTER")
  32.  
  33.     frameDateTextBox.text = frameDateTextBox:CreateFontString("frameDateTextBoxtext")
  34.     frameDateTextBoxtext:SetAllPoints(frameDateTextBox)
  35.     frameDateTextBoxtext:SetFontObject(FontList.rulesFont)
  36. end

I am really at a loss here and I wonder if I am at the point of being just too close to the code that I can't see obvious errors.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz

Last edited by Walkerbo : 08-15-22 at 04:52 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Scrolling list of frames


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off