Hi all
I have a bear-bones scroll set up that is over-scrolling past the last data button.
Here is my code:
Lua Code:
local function updateScrollFrame()
FauxScrollFrame_Update(
TestScrollFrame,
#TestData,
7,
20
)
for index = 1, 7 do
local offset = index + FauxScrollFrame_GetOffset(TestScrollFrame)
local button = TestScrollFrame.buttons[index]
button:SetNormalFontObject(NumberFontNormalLargeYellow)
button:SetHighlightFontObject(NumberFontNormalLargeYellow)
button.index = offset
if offset <= #TestData then
button:SetText(TestData[offset])
button:Show()
else
button:Hide()
end
end
end
local TestScrollFrame = CreateFrame("Frame", "TestScrollFrame", TestInterfaceFrame, "ChatConfigBoxTemplate")
TestScrollFrame:SetSize(500, 150)
TestScrollFrame:SetPoint("TOPLEFT", TestInterfaceFrame, "BOTTOMLEFT")
local TestScrollFrame =
CreateFrame("ScrollFrame", "TestScrollFrame", TestScrollFrame, "FauxScrollFrameTemplate")
TestScrollFrame:SetPoint("TOPLEFT", 0, -8)
TestScrollFrame:SetPoint("BOTTOMRIGHT", -30, 8)
TestScrollFrame:SetScript(
"OnVerticalScroll",
function(self, offset)
FauxScrollFrame_OnVerticalScroll(self, offset, 7, updateScrollFrame)
end
)
TestScrollFrame.buttons = {}
for index = 1, 7 do
TestScrollFrame.buttons[index] =
CreateFrame("Button", "$parentbtn" .. index, TestScrollFrame, "OptionsListButtonTemplate")
local button = TestScrollFrame.buttons[index]
button:SetSize(500, 20)
button:SetPoint("TOPLEFT", 8, -(index - 1) * 20 - 8)
button:SetScript(
"OnClick",
function(self, button)
if button == "RightButton" then
print(TestData, self.index)
updateScrollFrame()
end
end
)
end
How do I solve the over-scrolling issue?