01-22-2014 05:23 AM
Hi,
I am trying to create a boolean control typedef where the colour of the boolean text changes when the button is clicked, for example in the image below:
The background of the button is an image, but the text is loaded dynamically, so can not be part of the image. There is not a option in the properties to change the true/false text colour, but it can be changed by property node. I have hundreds of these buttons all with different text so do not want to have to set the properties programatically using property nodes. Is there a way to set the appearance as I want without having to set it for every button using a property node?
Thanks,
Neil
01-22-2014 05:41 AM
One way to do it is to have an array of references to all of the controls that you want to change and
use a for loop to set them in one go. You can add as many properties to the property node as you wish.
01-22-2014 05:42 AM - edited 01-22-2014 05:42 AM
01-22-2014 05:48 AM
Another neat way is to select all controls on the panel and then use the reference typecast to 'filter' the boolean controls for you.
Non booleans controls cause an error case and so no attempt is made to change their boolean text colour.
01-22-2014 05:55 AM
Hi NeilR, thanks for helping. I don't think I was clear enough in my description, as looking at your code, the BooltText.TextColors property node appears to change the background and foreground colour of the text in all cases, rather than the foreground colour of the text in the true and false cases. What I want to achieve is the text colour to change on clicking the button down.
Thanks,
Neil
01-22-2014 05:57 AM - edited 01-22-2014 05:58 AM
Hi NeilBH,
use an event structure to detect MouseClick events for those buttons. You get a control reference for the button from the event structure data terminal and so you can set the text color for the clicked button.
You might think about registering events for all buttons of your GUI, this might be easier than creating an event for 100+ buttons manually...
(Do you really have a GUI with "hundreds" of those buttons?)
01-22-2014 06:04 AM
Like this ...
01-22-2014 06:15 AM
Or for multiple controls, following on from Gerds advice ...
Like this Although if you have 100s of controls, adding them to the event structure won't be much fun !
01-22-2014 07:49 AM
01-24-2014 07:52 AM
Perhaps something like this.