Quantcast
WoWInterface - View Single Post - FauxScrollFrame Issues
View Single Post
05-25-20, 12:57 PM   #2
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
I haven't figured out exactly what your issue is yet - but I will point out things that I see.


In OnLoad you are creating too many fontstrings. The whole point of FauxScrollFrame is that only the visible items have widgets assoicated with them. It is like a window on your data

So this doesn't seem ritght

Lua Code:
  1. for i = 1,50 do
  2.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")

What you should be doing in your update is iterating over FauxScrollFame's list of items, and changing them to suit where your current window into the data is.

So lets see how big your window is.

According to what you tell FauxScrollFrame here

Lua Code:
  1. FauxScrollFrame_Update(self,50,1,12)

Here's the signature:

Lua Code:
  1. function FauxScrollFrame_Update(frame, numItems, numToDisplay, buttonHeight, button, smallWidth, bigWidth, highlightFrame, smallHighlightWidth, bigHighlightWidth, alwaysShowScrollBar)


You have 50 data items, and you want to show 1 item at a time.

So there is an issue.

So what you are supposed to do in your Update function, is get the offset, and use that as the starting position in your data array, then you iterate over the FauxScrollFrame's items, and set them to show what is in your data array. That way you don't have to create 50+ fontstrings.

I don't currently see the connection between your fontstrings and the FauxScrollFrame's items.

Whatever the number you pass as the numToDisplay parameter is the number of fontstrings you should create. Don't create any more than that.

What people normally do is define a constant NUM_DISPLAY_ITEMS, then use that to create the items, and to pass in the Update method

Hope that helps!

Last edited by sylvanaar : 05-25-20 at 01:14 PM.
  Reply With Quote