1. Hello,

    I have a frame that is created via XML and let's say the dimensions are 300 x 300. In order to add a 32x32 texture to that frame via LUA, can I just tag it onto the existing frame as a child or do I need to create a new frame in LUA with the desired dimensions, make it a child of the existing frame and then create a texture to SetAllPoints to the newly created frame?


    You can create the texture as a child of the existing frame without any issue. That's what the :CreateTexture() method does.

    Thanks. Judging from the replies to my other question, I was probably screwing up the SetPoint call for it.

    What's the proper way to call the global for the frame? If I have a frame created in XML called Testing can I use Testing:CreateTexture()?


    Here's the specific scenario driving this discussion.

    I have a frame called LRA that was created with XML. I can hide and show it with LRA:Hide()/LRA:Show() and the frame identifying macro show's it as LRA when I have my mouse over it.

    The issue is the following code will display the new frame and texture, but they're parented to the UIParent/WorldFrame and I have no idea why it's not working.

     f = CreateFrame("frame","$parentButtonFrame",LRA)
     local t = f:CreateTexture("$testIcon", "BACKGROUND")
     local _, class = UnitClass("player")
     local coords = CLASS_ICON_TCOORDS[class]
     f:SetPoint("CENTER", LRA, "CENTER", 0, 0)

    As you can see I try to attach it both by making LRA the parent of $parentButtonFrame as well as trying to set the relativeTo in the new frame's SetPoint call. I'm at a loss and frustrated as hell. It's like the globals for the XML frames just aren't there to access from LUA.

    Ok, now I'm really confused.

    I thought that there might have been an issue with the XML file creating the frame so I renamed my LRA.xml and added a new one which created the basic structure below. Both the frame and the texture are drawn, but the texture is still attached to UIParent.

     <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <Script file="LRA.lua" />
       <Frame name="LRA" parent="UIParent" toplevel="true">
           <AbsDimension x="200" y="200" />
           <Anchor point="TOPLEFT">
               <AbsDimension x="100" y="-150" />
         <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
                    <AbsInset left="11" right="12" top="12" bottom="11"/>
                    <AbsValue val="32"/>
                    <AbsValue val="32"/>

    Disregard. I feel like an idiot. Checked my TOC file and it was loading the .LUA file before the .XML file. Changed up the order and it was fixed.