Quantcast The InspectFrame cannot be a parent frame? - WoWInterface
Thread Tools Display Modes
05-22-10, 11:57 AM   #1
Lilithurian
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 10
The InspectFrame cannot be a parent frame?

Hi,

I'd like to use the InspectFrame as a parent frame, but I can't seem to anchor anything to it. I want my add-on to appear when u /inspect another player.

Any idea why this is not possible? Is there anything else I can do?

Code:
<Frame name="PPViewFrame" parent="InspectFrame" topLevel="true" enableMouse="true"> </Frame>
Greets,
  Reply With Quote
05-22-10, 12:10 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,671
Is the InspectFrame created yet when you are running your code?
__________________
"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
05-22-10, 12:10 PM   #3
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
The InspectFrame is part of the internal addon Blizzard_InspectUI and is only loaded on demand, thus when you first open it.
So, when your frame is created, it doesn't find the InspectFrame, because it simply does not exist at the time.

You have to watch when Blizzard_InspectUI is loaded / the InspectFrame is created and then parent your frame to it. Either by using PPViewFrame:SetParent(InspectFrame) or just creating your frame when the InspectFrame is loaded.
You could do this by hooksecurefunc'ing "InspectFrame_LoadUI" (called to load the InspectUI), "InspectUnit" (called every time an unit is inspected.

Or you just let your addon completely load with the InspectUI, depends on what you want to do with it. You'd have to add these in the .toc:
LoadOnDemand: 1
LoadWidth: Blizzard_InspectUI
__________________
Website | GitHub

Oh hai!
  Reply With Quote
05-23-10, 08:11 PM   #4
Arrowmaster
An Aku'mai Servant
Join Date: Dec 2006
Posts: 31
Originally Posted by Cargor View Post
You could do this by hooksecurefunc'ing "InspectFrame_LoadUI" (called to load the InspectUI), "InspectUnit" (called every time an unit is inspected.
It would be much much better to just listen to the ADDON_LOADED event for when the "Blizzard_InspectUI" addon loads than doing any ugly hooking like that.
  Reply With Quote
05-27-10, 02:48 AM   #5
Lilithurian
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 10
I decided I'm not going to use the InspectFrame as a parent, for it is too hard for me to work around as a beginning add-on author.

However thank you very much for your help, for pointing out to me how it could be done.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » The InspectFrame cannot be a parent frame?

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