Thread Tools Display Modes
09-15-09, 03:24 PM   #1
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
object with no name

Is there any way to reference/modify an object if it was not given a name?
  Reply With Quote
09-15-09, 04:27 PM   #2
Yhor
A Pyroguard Emberseer
 
Yhor's Avatar
Join Date: May 2007
Posts: 1,077
Originally Posted by Gethe View Post
Is there any way to reference/modify an object if it was not given a name?

Everything (should) has a name, you just have to figure out what it is. What is the object, what created it, and what do you want to do with it? Those answers should get you some help .

Edit: This thread may also be of help too..

http://www.wowinterface.com/forums/s...ad.php?t=27325

Last edited by Yhor : 09-15-09 at 04:30 PM.
  Reply With Quote
09-15-09, 04:51 PM   #3
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Gethe View Post
Is there any way to reference/modify an object if it was not given a name?
Of course, you just have to get a reference to it.

There are situations where that is not possible. Assuming it is possible, how you go about doing it depends on what you're trying to access. Knowing that would make it easier to help.
  Reply With Quote
09-15-09, 05:10 PM   #4
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
im trying to make a color picker addon and i want to move the ColorValueTexture object somewhere else, but blizz didn't give it a name.
  Reply With Quote
09-15-09, 07:59 PM   #5
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by Yhor View Post
Everything (should) has a name, you just have to figure out what it is. What is the object, what created it, and what do you want to do with it? Those answers should get you some help .

Edit: This thread may also be of help too..

http://www.wowinterface.com/forums/s...ad.php?t=27325
This isn't true. If I have this in an addon:

Code:
local f = CreateFrame'Frame'
Nothing can modify it in any way, at all (without editing the code itself).


Originally Posted by Gethe View Post
im trying to make a color picker addon and i want to move the ColorValueTexture object somewhere else, but blizz didn't give it a name.
The square showing the currently selected color value? It's called ColorSwatch. The UI developers are quite thorough. Almost everything in the default UI can be accessed by outside addons in one way or another, you just need to find out how. You should download the addon development kit to look through the UI code.
  Reply With Quote
09-15-09, 10:25 PM   #6
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Originally Posted by Waverian View Post
The square showing the currently selected color value? It's called ColorSwatch. The UI developers are quite thorough. Almost everything in the default UI can be accessed by outside addons in one way or another, you just need to find out how. You should download the addon development kit to look through the UI code.
i have looked through the code and what i am talking about is the slider with the gradient from the picked color to black, right of the color wheel, the tag used for it is ColorValueTexture. This object has no name.
  Reply With Quote
09-17-09, 07:45 PM   #7
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Waverian View Post
This isn't true. If I have this in an addon:

Code:
local f = CreateFrame'Frame'
Nothing can modify it in any way, at all (without editing the code itself).
This is what I used to think, but I had a discussion with Haste like two years ago in which, if I remember well, he explained that he used something that iterated among un-named frames in order to play with the unit plates (I can't remember the exact name, but you know, these bars that show up above your enemy's head, if you've enabled them in the default UI). I cannot remember exactly how it was done and it was a long time ago so I may have just mixed things up, but I think it's possible anyway.
  Reply With Quote
09-17-09, 09:25 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Akryn View Post
Of course, you just have to get a reference to it.

There are situations where that is not possible. Assuming it is possible, how you go about doing it depends on what you're trying to access. Knowing that would make it easier to help.
QFE

For example, this is how I modify the game clock in PocketPlot:
Code:
	clockFrame, clockTime = TimeManagerClockButton:GetRegions()
	clockFrame:Hide()
	clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-18-09, 05:48 AM   #9
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Layrajha View Post
This is what I used to think, but I had a discussion with Haste like two years ago in which, if I remember well, he explained that he used something that iterated among un-named frames in order to play with the unit plates (I can't remember the exact name, but you know, these bars that show up above your enemy's head, if you've enabled them in the default UI). I cannot remember exactly how it was done and it was a long time ago so I may have just mixed things up, but I think it's possible anyway.
After thinking about it again and reading Seerah's example, I think it was just something like looping through the children of UIParent or WorldFrame, or something like this. As you create a frame with no parent by calling CreateFrame'Frame', this method wouldn't work.

The only way I can think of to gain access to this frame (without editing your code) would be to hook CreateFrame or one of the methods that you use on the frame, using an addon loaded before yours. I'm not sure how the hook would recognize your frame among the other frames created though. Using debugstack() would probably work?
  Reply With Quote
09-18-09, 06:37 AM   #10
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
Originally Posted by Layrajha View Post
After thinking about it again and reading Seerah's example, I think it was just something like looping through the children of UIParent or WorldFrame, or something like this.
Correct. Something along the lines of (for nameplates at least):

(Drycoded)

local nameplates = { WorldFrame:GetChildren() }
local num = #nameplates

if num > 0 then
for i = 1, num do
nameplates[i]:<Method>(...) -- do something
end
end


As you create a frame with no parent by calling CreateFrame'Frame', this method wouldn't work.
Also correct, as I've mentioned in a similar thread.

The only way I can think of to gain access to this frame (without editing your code) would be to hook CreateFrame or one of the methods that you use on the frame, using an addon loaded before yours. I'm not sure how the hook would recognize your frame among the other frames created though. Using debugstack() would probably work?
Not sure if that would accomplish much, since it has too many issues plus I'm not even sure if the hook would execute for frames created via xml.

All in all, if you absolutely need to reference/modify an unnamed frame created by another addon, either bug the author to "expose" it or find a way around it. More often than not, unnamed frames exist in such a state for good reason.
__________________
  Reply With Quote
09-18-09, 06:41 AM   #11
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by Layrajha View Post
This is what I used to think, but I had a discussion with Haste like two years ago in which, if I remember well, he explained that he used something that iterated among un-named frames in order to play with the unit plates (I can't remember the exact name, but you know, these bars that show up above your enemy's head, if you've enabled them in the default UI). I cannot remember exactly how it was done and it was a long time ago so I may have just mixed things up, but I think it's possible anyway.
I'm aware of the concept, but it's hardly reliable for the vast majority of frames. Nameplates are a rare exception because of some of their attributes.

Nameplates are unnamed children of the worldframe whose GetTexture() call returns Interface\TargetingFrame\UI-TargetingFrame-Flash

My frame has no defining attributes at all, and isn't a child of anything. While this isn't necessarily the case for the frame in question, finding these defining attributes (if they exist) wouldn't be trivial.
  Reply With Quote
09-18-09, 07:40 AM   #12
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
My frame has no defining attributes at all, and isn't a child of anything
If you know when it's created you can find it.

also you can still find frames with no parents via EnumerateFrames().

What I use in StatusQuo:
lua Code:
  1. local lastframe -- the last frame we met.
  2. local otype
  3. local function TextureStatusBars(f)
  4.     local f = EnumerateFrames(f)
  5.     while f do
  6.         otype = f:GetObjectType()
  7.         if otype ~= "Button" then
  8.             if otype == "StatusBar" then
  9.                 SetTexture(f)
  10.                 f.SetStatusBarTexture = dummy
  11.             end
  12.             lastframe = f
  13.         end
  14.         f = EnumerateFrames(f)
  15.     end
  16. end
  17.  
  18. local function TextureNewStatusBars()
  19.     TextureStatusBars(lastframe)
  20. end
  Reply With Quote
09-20-09, 04:35 AM   #13
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Slakah View Post
EnumerateFrames()
Ah, I wasn't sure anymore but I wondered if something along this line didn't exist Thank you for refreshing my memory.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » object with no name

Thread Tools
Display Modes

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