2022-03-28 12:25 PM
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
2022-04-07 07:47 AM
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
2022-04-19 04:29 PM
I am looking to do change theme color