Thread Tools Display Modes
10-28-09, 08:30 PM   #1
richardCANE
A Murloc Raider
Join Date: Oct 2009
Posts: 5
Remove a Frame element with LUA

hi guys

i want to create a frame that shows your main bag's content with icons too...

so when i open up my addon frame the LUA dynamically draws a frame and draws the CURRENT content of my bag into...

is it possible to remove/delete/clear frames, textures and fontstrings ( xml elements ) with LUA somethings like Frame:Delete ?

thanks for any replies
  Reply With Quote
10-28-09, 08:54 PM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
No, this is not possible. Nor is it possible to give them to the Lua garbage collection facility. What you need to do is create these things once and re-use them as they're needed.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-29-09, 04:25 AM   #3
richardCANE
A Murloc Raider
Join Date: Oct 2009
Posts: 5
thanks for reply

and how to do that? can you give me some little example in LUA? how can i reuse the elements?
  Reply With Quote
10-29-09, 04:32 AM   #4
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
lua Code:
  1. local framepool = {}
  2.  
  3. local function removeframe(f)
  4.     f:Hide()
  5.     tinsert(framepool, f)
  6. end
  7.  
  8. local function getframe()
  9.     local f = tremove(framepool)
  10.     if not f then
  11.         --Create your frame here and assign it to f
  12.     else
  13.         --revert any unique changes you may have made to the frame before sticking it in the framepool
  14.     end
  15.     return f
  16. end

Something like that as a very basic example
  Reply With Quote
10-29-09, 04:59 AM   #5
richardCANE
A Murloc Raider
Join Date: Oct 2009
Posts: 5
thank you so much
  Reply With Quote
11-23-09, 01:32 PM   #6
maximdewit
A Murloc Raider
 
maximdewit's Avatar
Join Date: Nov 2009
Posts: 4
cant you for example simply write frame=nil?

dont shoot me ^^

--
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Remove a Frame element with LUA


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off