+ Reply to Thread
Results 1 to 3 of 3

Thread: SetTexture changes z-order - why?

  1. #1
    Soulwalker
    Join Date
    Dec 2012
    Posts
    15

    Default SetTexture changes z-order - why?

    Please see this code snippet:

    testWindow = UI.CreateFrame("Texture", "test", context)
    testWindow:SetTexture( "MyAddon", "mysample.png")
    testWindow2 = UI.CreateFrame("Text", "test2", testWindow)
    testWindow2:SetPoint( "CENTER", testWindow, "CENTER" )
    testWindow2:SetText("8")
    testWindow2:SetFontSize(80)

    It correctly places text over texture.

    If we set texture after text windows is created, no matter what texture will be placed OVER the text.

    testWindow = UI.CreateFrame("Texture", "test", context)
    testWindow2 = UI.CreateFrame("Text", "test2", testWindow)
    testWindow2:SetPoint( "CENTER", testWindow, "CENTER" )
    testWindow2:SetText("8")
    testWindow2:SetFontSize(80)
    testWindow:SetTexture( "MyAddon", "mysample.png")

    Why is this happening? Is there way to prevent SetTexture from changing z-order?
    Last edited by Sentinos; 11-01-2013 at 10:56 AM.

  2. #2
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    Known issue of texture frames.

    The trick is to avoid creating visible frames whose parent is a texture. Instead, you can use a normal frame that is parent of both the texture and the text frame, and use SetLayer so the text frame is shown above the texture.

  3. #3
    Soulwalker
    Join Date
    Dec 2012
    Posts
    15

    Default

    Thank you, it solved the problem.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts