View Single Post
09-05-12, 04:10 PM   #1
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
Scroll child draw order

Whenever I parent frames to a scroll child, it seems the rendering order of those frames are not governed by frame stratas / frame levels / draw layers but by the order in which they are added to the scroll child. For example:

Code:
local foreground = CreateFrame("Frame", "my_foreground", QuestLogScrollFrameScrollChild)
foreground:SetSize(100, 100)
foreground:SetPoint"center"

local texture = foreground:CreateTexture()
texture:SetAllPoints()
texture:SetTexture(0,1,0)

local background = CreateFrame("Frame", "my_background", QuestLogScrollFrameScrollChild)
background:SetSize(100,100)
background:SetPoint"center"
background:SetFrameLevel(foreground:GetFrameLevel() - 1)

local texture = background:CreateTexture()
texture:SetAllPoints()
texture:SetTexture(1,0,0)
Since foreground (or green box) is one frame level above background (red box), it should be the one rendered on screen. Instead I get this:



Notice the framestack tooltip. Manipulating frame levels, frame stratas or draw layers changes nothing, the order of parenting does. If the frames are created with UIParent as their initial parent, the one that calls :SetParent(scrollchild) last gets to be rendered on screen. Am I overlooking something or is this how it is supposed to work?
  Reply With Quote