WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Problem: ScrollBar (https://www.wowinterface.com/forums/showthread.php?t=51999)

odjur84 02-27-15 08:59 AM

Problem: ScrollBar
 
1 Attachment(s)
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.

Duugu 02-27-15 11:10 AM

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);

odjur84 02-27-15 04:17 PM

Thank you very much, Duugu!

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

Cheers!

Duugu 02-27-15 04:22 PM

Quote:

Originally Posted by odjur84 (Post 307050)
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.

odjur84 02-28-15 06:19 AM

Thanks again, Duugu. I've tested it and you're right!


All times are GMT -6. The time now is 02:20 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI