Go Back   WowAce Forums > Addon Chat > AddOn HELP!
AddOn HELP! Requests for assistance and misc bug reports go here.

Reply
 
Thread Tools
Old 01-09-2009   #1
adriweb
Member
 
adriweb's Avatar
 
Join Date: Dec 2008
Posts: 27
Question MerchantItem frame : its name...

Hey everybody,

for my addon VendorSearch, I come with a solution or searching, and it's so hide the Items' frame if it's not matching the keyword you're looking for.

Technically, it works.

But I still have a problem when I want to get the frame name and to Hide() it.

Here is the code :
PHP Code:
 f=CreateFrame("Frame","MerchantItem" .. i) -- i is from a for loop and start from 1, and go to the number of the total items from this vendor
if /codethen
  f
:Show();
      /
Some other code/
else
  
f:Hide();
      /
Some other code/
end 
I actually tried a lot of combinations using the frames name for MerchantItem, but because the name of the frame is apparently not a string, it maybe doesn't concatenate with the value of "i"...

but it's basically the equivalent of something like that, that I want :

/script MerchantItem2:Hide()

and that works.... All I can't get is the number after the frame name....


Thanks for your help !
__________________
VendorSearch : Creates a search bar to search through a vendor's items ! You are now able to find much faster the item you want, in a cleaned Vendor frame.

Last edited by adriweb; 01-09-2009 at 02:30 AM. Reason: better now
adriweb is offline   Reply With Quote
Old 01-09-2009   #2
Nickenyfiken
Hero Member
 
Join Date: Aug 2008
Posts: 798
Default Re: MerchantItem frame : its name...

CreateFrame(...) creates a new frame and then you hide it or show it. I guess thats wrong.

You need to get the frame somehow. _G["MerchantItem"..i]:Hide() should work.

Nickenyfiken is offline   Reply With Quote
Old 01-09-2009   #3
adriweb
Member
 
adriweb's Avatar
 
Join Date: Dec 2008
Posts: 27
Default Re: MerchantItem frame : its name...

Thanks !

actually, I found a way just before to see your answer :

Quote:
f = getglobal("MerchantItem" ..i)
__________________
VendorSearch : Creates a search bar to search through a vendor's items ! You are now able to find much faster the item you want, in a cleaned Vendor frame.
adriweb is offline   Reply With Quote
Old 01-09-2009   #4
Nickenyfiken
Hero Member
 
Join Date: Aug 2008
Posts: 798
Default Re: MerchantItem frame : its name...

Quote:
Originally Posted by adriweb View Post
Thanks !

actually, I found a way just before to see your answer :

Yeah it is almost the same thing. I think _G[] is faster/better because that way the table is accessed directly.

I think many developers do:
Code:
local G = _G
...code...
local frame = G["FrameName"]
...
I think thats the cleanest way too. Someone correct me if I'm wrong.
Nickenyfiken is offline   Reply With Quote
Old 01-09-2009   #5
adriweb
Member
 
adriweb's Avatar
 
Join Date: Dec 2008
Posts: 27
Default Re: MerchantItem frame : its name...

well, that sounds interesting,

thanks
__________________
VendorSearch : Creates a search bar to search through a vendor's items ! You are now able to find much faster the item you want, in a cleaned Vendor frame.
adriweb is offline   Reply With Quote
Old 01-10-2009   #6
Phanx
Seal Cub Clubbing Club
 
Phanx's Avatar
 
Join Date: May 2005
Location: United States
Posts: 8,056
Default Re: MerchantItem frame : its name...

getglobal is just a useless function wrapper to _G. Basically, getglobal is this:

function getglobal(x)
return _G[x]
end
Phanx is offline   Reply With Quote
Reply

Tags
concatenate, frame, item, merchant, merchantitem


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Forum Jump


All times are GMT. The time now is 05:10 AM.