1. So I'm creating a table dynamic buttons/textures and I came across an interesting happening. I'm reusing the array and setting the buttons/texture variables to nil and for some reason they don't want to vanish off the screen. I know I can :Hide before I re-initialize the table, but that seems to be a big extra step. Is there some function call I should be doing on the UI to remove these properly?

     f, t = {}
     local x = 0;
     for x = 1, 3 do 
        f[x] = CreateFrame("Button",nil,UIParent)
        f[x]:SetFrameStrata("FULLSCREEN_DIALOG")
        f[x]:SetSize(50,50)
        t[x] = f[x]:CreateTexture(nil,"BACKGROUND")
        t[x]:SetTexture("Interface\\AddOns\\SkyfireGMH\\Imgs\\InvisFlagOn.tga")
        t[x]:SetAllPoints(f[x])
        f[x]:SetPoint("RIGHT",UIParent)
        f[x]:Show()
     end
    

    /run f,t = {} -- Destroys the global variables, but doesn't remove the buttons/textures from the screen

    (p.s. I know, i'm stacking them all on top of each other. The move-around code is a bit tedious to include)

  2. You cannot remove a button. Once it's created, it's always there and you are 100% responsible for hiding (or re-using) the button as appropriate. Buttons are not garbage collected, and in fact can never be deleted.

  3. So how do people who use buttons for scrolling tables and the like deal with reusing? Something is fishy... All other frame type elements dislodge but buttons don't? I can understand if textures don't go away, because they propagate at the time the client loads.

  4. No frame elements or textures are ever freed. Ever.

    If you have a scrolling list, you simply create the number you want to display (say 20) and then only ever display those 20. The chapter on scrolling frames goes into this (called FauxScrollFrames).

    You cannot remove frames or textures. There's no automatic cleanup. You have to manually create a pool of resources if you want to use it.

    We're speaking abstractly. Give me an actual situation, and I'll tell you how it would be done.

  5. That makes sense I guess. A little disheartening, but sure clears up some of the behaviors I've seen.

    Well, in this instance I'd like to create four buttons (which I do by array). Then I'm calling Set[Highlight/Disabled/Normal/Pushed]Texture to each of these buttons. They don't need to be secure or anything jazzy since each of them only open up a sub panel in the Mod itself, But I'd like to be able to change the icons on the fly (I have a pre-tailored directory to choose icons from). I'm thinking I'll need to call the appropriate Set[]Texture again on the chosen button with the new texture, something like:

     f[1]:SetPushedTexture("\\Interface\\BUTTONS\\internal_artwork_example")
    

    Is repetition of calling this function on the button some 20 times in a row going to cause any problems? (I'd like to reuse a button for a preview)

  6. That makes sense I guess. A little disheartening, but sure clears up some of the behaviors I've seen.

    Well, in this instance I'd like to create four buttons (which I do by array). Then I'm calling Set[Highlight/Disabled/Normal/Pushed]Texture to each of these buttons. They don't need to be secure or anything jazzy since each of them only open up a sub panel in the Mod itself, But I'd like to be able to change the icons on the fly (I have a pre-tailored directory to choose icons from). I'm thinking I'll need to call the appropriate Set[]Texture again on the chosen button with the new texture, something like:

     f[1]:SetPushedTexture("\\Interface\\BUTTONS\\internal_artwork_example")
    

    Is repetition of calling this function on the button some 20 times in a row going to cause any problems? (I'd like to reuse a button for a preview)

    No, not even a little bit =) That's what they're designed for :P