cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX how to get the type of my Drawable

aabba.1
Associate III

Hi,

I have multiple Drawable on my screen and I want to change the color. I decide to iterate through my screen and depending of my drawable perform some modification. Right now I am using typeid() to extract the Drawable, it work for some Drawable but not for all (slider for example). Do you have any idea how to get the type? (On the past there was a function call getType(), but now it's deprecated)

Drawable* component;

component = this->getRootContainer().getFirstChild();

while (component)

{

//If box to this

//if textarea to this

//if slider to this

component = component->getNextSibling();

}

Thank you

2 REPLIES 2
Yoann KLEIN
ST Employee

Hello @aabba.1​ ,

You are right, unfortunately the getType() method is not supported on TouchGFX latest versions anymore. There is no real work-around to achieve exactly what you want, but if you want to make this piece of code a little bit dynamic you could put all your components that are from the same type (e.g. all boxes) in a list, then iterate through that list to change the color of each element.

Could you also please provide the whole user case of your project ? It might help us determining if it could be useful to implement that functionality again.

Thanks,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

I am looking to do change theme color