View Single Post
02-27-15, 08:59 AM   #1
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Problem: ScrollBar

Hi!

After I finally managed to get a standard-scrollbar working on my frame (based on this this snippet), I've encountered a (in my opinion) strange issue. I can add a row of buttons on the content frame and then scroll through them, but when i try the same with several frames, they aren't scrollable (my guess: they aren't placed on the scrollchild, what they should be...).

This works fine:

Code:
local content = CreateFrame("Frame", "ORC_content", scrollframe)
content:SetSize(128, 128);
local ORC_dummyvar = -10;
for i = 1, 10 do
    newButton = CreateFrame("Button", nil, content, "UIPanelButtonTemplate");
    newButton:SetSize(65,20);
    newButton:SetPoint("TOPLEFT", 10, ORC_dummyvar);
    ORC_dummyvar = ORC_dummyvar - 50;
end
ORCA_lastposition = ORCA_lastposition - 70;
end
scrollframe.content = content;
scrollframe:SetScrollChild(content);
And this, for some unknown reason, doesn't:

Code:
local content = CreateFrame("Frame", "ORC_content", scrollframe)
content:SetSize(128, 128);
for i = 1, 10 do
newFrame = CreateFrame("Frame", nil, content);
newFrame:SetSize(160, 70);
newFrame:SetPoint("TOPLEFT", "ORC_FrameAdminLoot", "TOPLEFT", 20, ORCA_lastposition);
newFrame:SetBackdrop( { 
  bgFile = ORC_backdropfile, 
  edgeFile =  "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, 
  insets = { left = 0, right = 0, top = 0, bottom = 0 }
});
ORCA_lastposition = ORCA_lastposition - 70;
end
scrollframe.content = content;
scrollframe:SetScrollChild(content);
Can anybody find the error? And can anyone answer me this: Is it possible to fill the content frame with content afterwards, perhaps by using a button, without interfering in the scrolling-abilities?

I'm sure you can help me and I'd really appreciate every hint.

Yours,

odjur84

PS: I've added the whole source code, just to be sure.
Attached Files
File Type: lua Frame.lua (8.3 KB, 116 views)
  Reply With Quote