I'm having a hard time understanding how the scrollframe works, I've finally managed to put together someting that looks like a scrollframe, I have my scrollchild (f) and my scrollframe but it won't scroll, what did I miss?
Code:
local tbl = {
[2393] = "hello",
[3293] = "hey",
[3393] = "blabla",
[12942] = "new",
[21541] = "new",
[21542] = "new",
[21543] = "new",
[21544] = "new",
[11431] = "new",
[11433] = "new",
[11434] = "new",
[11435] = "new",
}
SFrame = CreateFrame("SCROLLFRAME", "SFrame", UIParent, "UIPanelScrollFrameTemplate");
SFrame:SetPoint("LEFT", UIParent)
SFrame:SetWidth(160);
SFrame:SetHeight(100);
SFrame:SetHorizontalScroll(0)
SFrame:SetVerticalScroll(0)
SFrame:Show();
SFrame:SetBackdrop( {
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
SFrame:SetBackdropColor(0, 0, 0, 0.5)
SFrame:SetBackdropBorderColor(1, 1, 1, 1)
local f=CreateFrame("ScrollingMessageFrame","crap",SFrame)
f:SetWidth(160)
f:SetHeight(120)
f:SetFontObject("GameFontNormal")
f:SetJustifyH("LEFT")
f:SetJustifyV("TOP")
f:SetScript("OnHyperlinkClick", function(self, linkData, link, button)
if IsShiftKeyDown() then
ChatEdit_InsertLink(link)
else
ChatFrame_OnHyperlinkShow(linkData, link, button)
end
end)
f:SetSpacing(0)
f:SetMaxLines(10)
f:SetFading(false)
SFrame:SetScrollChild(f)
local function AddLinks()
local text = ""
for k, v in pairs(tbl) do
print(k)
text = text .. GetSpellLink(k).."\n"
end
f:AddMessage(text)
end
AddLinks()