View Single Post
03-10-21, 10:05 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Assuming this is for a ScrollList, when you update each button information during OnVerticalScroll is when you set each button .index to the corresponding entry in SpellList

Incomplete and rough as example for OnVerticalScroll
Lua Code:
  1. self.ScrollBar:SetValue(offset)
  2. self.offset = math.floor(offset / itemHeight)
  3. local newOffset = self.offset or 0
  4. for i = 1, #DeathKnightChatScrollFrame.buttons do
  5.     local index = newOffset + i
  6.     if not DeathKnightSpellList[index] then
  7.         break
  8.     end
  9.     local button = DeathKnightChatScrollFrame.buttons[i]
  10.     button.Text:SetText(DeathKnightSpellList[index].spelllink)
  11.     button.index = index -- self.index used to get the spell entry in OnClick
  12. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-10-21 at 10:31 PM.
  Reply With Quote