View Single Post
09-18-14, 09:46 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Your caching table and the CreateRow function need to be defined outside of the update function -- otherwise, every time you call the update function, you're creating a new list of rows instead of using the old one, which defeats the purpose of keeping a list of already-created rows in the first place.

Also, your CreateRow function cannot refer to variables that are inside the update function. If you already know you want the first row to be 100px from the left and 0px from the top, just hardcode 110 and 0 as the position offsets. Since each additional row is anchored relative to the previous row, instead of all rows being anchored relative to the parent frame, there's no need to keep track of the y offset or change any positions in the update function.

Similarly, you only need to pass the row number to the CreateRow function -- you don't need to pass a reference to the list of created frames, and you don't need to pass any position offsets.

The :SetID() call doesn't really matter as far as reusing rows go, but it does mean that if you have a reference to the row frame, you can call :GetID() to find out [b]which[/i] row it is.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 09-18-14 at 09:49 PM.
  Reply With Quote