Quantcast
Problem: ScrollBar - WoWInterface
Thread Tools Display Modes
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, 68 views)
  Reply With Quote
02-27-15, 11:10 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I would say it's about the SetPoint:

newFrame:SetPoint("TOPLEFT", "ORC_FrameAdminLoot", "TOPLEFT", 20, ORCA_lastposition);

The second parameter should be the parent object - not a string. Plus it has to be the content Frame (don't know what ORC_FrameAdminLoot is ... is it even anchored to the content frame?).

newFrame:SetPoint("TOPLEFT", content, "TOPLEFT", 20, ORCA_lastposition);
  Reply With Quote
02-27-15, 04:17 PM   #3
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Thank you very much, Duugu!

I thought, a "relative to"-frame could also be the underlying master-frame. But obviously not.

Cheers!
  Reply With Quote
02-27-15, 04:22 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by odjur84 View Post
I thought, a "relative to"-frame could also be the underlying master-frame. But obviously not.
Should be ok too if the "master-frame" is a child of/anchored to content and an object instead of a string.
  Reply With Quote
02-28-15, 06:19 AM   #5
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Thanks again, Duugu. I've tested it and you're right!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Problem: ScrollBar

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off