WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   GetChildren() not working for FontStrings? (https://www.wowinterface.com/forums/showthread.php?t=57251)

LudiusMaximus 07-02-19 05:57 PM

GetChildren() not working for FontStrings?
 
According to https://wow.gamepedia.com/API_Frame_GetChildren GetChildren() gets the children of a frame.

According to https://wow.gamepedia.com/API_Frame_CreateFontString CreateFontString() creates a FontString as a child of a frame.

However, GetChildren() does apparently only get children frames. FontStrings are ignored.

Is this correct?

And if so, is there any other way of getting to the FontStrings of a frame when these FontStrings were created with CreateFontString() lacking a name argument?

Thanks!

jeruku 07-02-19 06:35 PM

Font Strings and Textures are added as Regions so GetRegions() should return it.

LudiusMaximus 07-02-19 06:46 PM

Cool, thanks a lot!! :-)

Is there a better way of checking if a child region is a FontString than "if child.GetText"?

MunkDev 07-02-19 06:52 PM

Quote:

Originally Posted by LudiusMaximus (Post 332703)
Cool, thanks a lot!! :-)

Is there a better way of checking if a child region is a FontString than "if child.GetText"?

Lua Code:
  1. child:IsObjectType("FontString")

Fizzlemizz 07-02-19 06:53 PM

or
Code:

type = widget:GetObjectType()

LudiusMaximus 07-02-19 06:56 PM

Thank you both!

So I assume there is no difference between

Code:

child:IsObjectType("FontString")
and

Code:

child:GetObjectType() == "FontString"
.

Fizzlemizz 07-02-19 07:30 PM

No, Just depends on what you want to do with it. I was just a second late pressing "Submit" :D

SDPhantom 07-03-19 12:57 PM

Quote:

Originally Posted by LudiusMaximus (Post 332706)
Thank you both!

So I assume there is no difference between
Code:

child:IsObjectType("FontString")
and
Code:

child:GetObjectType() == "FontString"

I think IsObjectType() works on objects that inherit methods from the specified type. For example, buttons may return true for IsObjectType("Frame").


All times are GMT -6. The time now is 08:07 AM.

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