Thanks again for you replies.
I think I have added the Settext ...
I packed your code in a simple addon so we can test better.
The code is:
Lua Code:
local NUM_BUTTONS = 8
local BUTTON_HEIGHT = 20
local list = {"aaaa","bbbbb","cccccc","ddddddd","eeeeee","ffffff","gggggg","hhhhh"}
local buttons = {}
local function update(self)
local numItems = #list
print ("DEBUG: nr. items " .. numItems)
FauxScrollFrame_Update(self, numItems, NUM_BUTTONS, BUTTON_HEIGHT)
local offset = FauxScrollFrame_GetOffset(self)
for line = 1, NUM_BUTTONS do
local lineplusoffset = line + offset
local button = buttons[line]
if lineplusoffset > numItems then
button:Hide()
else
button:SetText(list[lineplusoffset])
button:Show()
end
end
end
local scrollFrame = CreateFrame("ScrollFrame", "MyFirstNotReallyScrollFrame", UIParent, "FauxScrollFrameTemplate")
scrollFrame:SetScript("OnVerticalScroll", function(self, offset)
FauxScrollFrame_OnVerticalScroll(self, offset, BUTTON_HEIGHT, update)
end)
for i = 1, NUM_BUTTONS do
local button = CreateFrame("Button", nil, scrollFrame:GetParent())
if i == 1 then
button:SetPoint("TOP", scrollFrame)
else
button:SetPoint("TOP", buttons[i - 1], "BOTTOM")
end
button:SetSize(96, BUTTON_HEIGHT)
button:SetText(list[i])
buttons[i] = button
end
print ("DEBUG: Force updating")
update(scrollFrame)
I attach also the zip file of the addon directory.
Thanks again.