1. I have a frame created via XML and I'm trying to dynamically create class icons as childs using a loop in LUA. For some reason I can't get anything to show up. I've also tried just doing a single texture and a single font string. I get no LUA errors but the texture/fontstring just doesn't show up.

    The code that I'm using is just sitting in the .lua file (not in a function). Here's an example of what I've tried. LRAMainSpec being the XML frame.

     local initialX, initialY = "32", "32"     
     local classicon = LRAMainSpec:CreateTexture(nil, "ARTWORK")
     classicon:SetSize(32, 32)
     classicon:SetPoint("TOPLEFT", nil, nil, initialX, initialY)
     local _, class = UnitClass("player")
     local coords = CLASS_ICON_TCOORDS[class]
     classicon:SetTexture("Interface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES")
     classicon:SetTexCoord(unpack(coords))
    

    I'm very new to addon development so any help would be greatly appreciated.

  2. I finally got the texture to show but creating a frame for it using LUA. When creating a texture in LUA will I always have to create a frame for it before hand in LUA?

    Also even with the LUA created frame, I can't seem to child it to any of the frames that I created via XML.

  3. Why are you sending two nils for the SetPoint calls. Those really have to be set. The first is the frame that you're anchoring to, and the second is the point on that frame you want to anchor to. Use them =)

  4. Does it not work like XML where they can be omitted?

    Where realtivePoint defaults to what point is set to and relativeTo defaults to the parent (Which should be LRAMainSpec as I'm calling LRAMainSpec:CreateTexture()).

  5. Here's the code I use in Trav's Unit Frame Extensions, expanded a bit, using PlayerFrame as an example:

     local f = CreateFrame("Frame", "$parentClass", PlayerFrame)
     f:SetFrameStrata("MEDIUM")
     f:SetWidth(32)
     f:SetHeight(32)
     local t = f:CreateTexture("$parentIcon", "BACKGROUND")
     t:SetTexture("Interface\\AddOns\\UFE\\ClassIcons\\Unknown")
     t:SetAllPoints(f)
     f:SetPoint("CENTER", -12, 26)
     f:Show()
    

    According to WoWPedia, if "relativeTo" and "relativePoint" are both omitted, then the point will be defined relative to UIParent. This doesn't match my experience -- I don't pass either, but the point gets set relative to the defined parent frame. You'll note, though, that I'm using the option of not passing those at all, rather than passing them in as nil. I'm suspecting that WoWPedia's description is correct if you explicitly pass both as nil, and the position gets set relative to UIParent regardless of who the actual defined parent is. I don't have a way to test that right this minute, though.

    (This code is in the UFE_IconFactory() function, which creates the frames to hold all the class icons. Another function actually sets a class icon, and is called when needed.)

  6. If you know what they are, why wouldn't you specify them? Alternatively, use the three-argument form instead. I can't really debug for you, but I can answer specific questions if you have them.

  7. An offset of 32,32 from UIParent's TOPLEFT would be off the screen, so you wouldn't see anything unless your texture was large enough for part of it to show up. You might want to try changing your code to put CENTER as the relative point, and see if your texture then shows up near the center of the screen -- if it does, then it's being placed relative to UIParent.

    As it stands, though, I'd recommend just leaving out the "nil, nil" part of your SetPoint call. It's not required, and if I'm guessing correctly, it should fix your problem.

  8. Yeah, keep in mind that coordinates go up from the bottom left of the screen, so 32, 32 is going to be 32 pixels above the top of the screen and 32 pixels to the right. Start with something simple, like "CENTER",0, 0 and work from there..

  9. That's guys, I appreciate the help! That also clears up the confusing bit about the X axis being inverted. I'm used to X starting at the top of the screen.

  10. For reference, SetPoint has a number of possible call signatures. Calling with string, number, number will default relativeTo and relativePoint (the same way you describe). Calling with 5 arguments, however, will, from what I've experienced, set them relative to no frame (the screen) if no relativeTo is passed.