Quantcast GetChildren() not working for FontStrings? - WoWInterface
Thread Tools Display Modes
07-02-19, 05:57 PM   #1
LudiusMaximus
A Flamescale Wyrmkin
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 112
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!
  Reply With Quote
07-02-19, 06:35 PM   #2
jeruku
A Chromatic Dragonspawn
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 198
Font Strings and Textures are added as Regions so GetRegions() should return it.
  Reply With Quote
07-02-19, 06:46 PM   #3
LudiusMaximus
A Flamescale Wyrmkin
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 112
Cool, thanks a lot!! :-)

Is there a better way of checking if a child region is a FontString than "if child.GetText"?
  Reply With Quote
07-02-19, 06:52 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 425
Originally Posted by LudiusMaximus View Post
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")
__________________
  Reply With Quote
07-02-19, 06:53 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,129
or
Code:
type = widget:GetObjectType()
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-02-19 at 06:55 PM.
  Reply With Quote
07-02-19, 06:56 PM   #6
LudiusMaximus
A Flamescale Wyrmkin
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 112
Thank you both!

So I assume there is no difference between

Code:
child:IsObjectType("FontString")
and

Code:
child:GetObjectType() == "FontString"
.
  Reply With Quote
07-02-19, 07:30 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,129
No, Just depends on what you want to do with it. I was just a second late pressing "Submit"
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-03-19, 12:57 PM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,823
Originally Posted by LudiusMaximus View Post
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").
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 07-03-19 at 01:00 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetChildren() not working for FontStrings?

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