Hi!
I'm trying to figure out a bug where frame parent/child ordering doesn't work properly on scroll frames. I've determined that either I'm missing something, or the SetScrollChild() function is bugged.
Take the following sample code:
Code:
local scrollFrame = CreateFrame("ScrollFrame", "TestScrollFrame", UIParent)
scrollFrame:SetSize(100, 100)
scrollFrame:SetPoint("CENTER")
scrollFrame:SetBackdrop({
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
})
scrollFrame:SetBackdropColor(0, 0, 0, .5)
local scrollChild = CreateFrame("Frame", "TestScrollFrameContents", scrollFrame)
scrollChild:SetSize(100, 100)
scrollChild:SetPoint("TOP", scrollFrame, "TOP")
scrollFrame:SetScrollChild(scrollChild)
local check = CreateFrame("CheckButton", "TestCheckButton", scrollChild, "InterfaceOptionsCheckButtonTemplate")
check:SetPoint("CENTER")
check:SetNormalTexture("")
local bd = CreateFrame("Frame", nil, check)
bd:SetPoint("TOPLEFT", 4, -4)
bd:SetPoint("BOTTOMRIGHT", -4, 4)
bd:SetFrameLevel(check:GetFrameLevel()-1)
bd:SetBackdrop({
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
})
bd:SetBackdropColor(0, 0, 0)
This creates a semi-transparent ScrollFrame with an equally sized frame as its child. In the centre of the child is a check button with a solid black background. I know I could just use SetBackdrop on the check button, but I need to use frames as a backdrop for a specific reason in my addon.
The problem here is that for some reason, the check button's background frame appears on top of the check button, despite the fact that its frame level is lower. So, the checked texture will appear behind the black background.
However, if I comment out this line:
Code:
scrollFrame:SetScrollChild(scrollChild)
The background will appear
behind the check button, even though scrollChild already had scrollFrame as its parent during creation.
What is the problem here?
The only other thing I've managed to find on this problem is this:
http://blue.cardplace.com/newcache/f...4311215435.htm and the issue is unresolved there too.