WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   The InspectFrame cannot be a parent frame? (https://www.wowinterface.com/forums/showthread.php?t=32654)

Lilithurian 05-22-10 11:57 AM

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,

Seerah 05-22-10 12:10 PM

Is the InspectFrame created yet when you are running your code?

xConStruct 05-22-10 12:10 PM

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

Arrowmaster 05-23-10 08:11 PM

Quote:

Originally Posted by Cargor (Post 188929)
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.

Lilithurian 05-27-10 02:48 AM

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. :)


All times are GMT -6. The time now is 01:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI