What happens when the button is clicked? Is there any tag that is set to a corresponding value? If so, you would just need to bind a custom prop to that tag and then call the script on property change of that value. Otherwise, to make it generic, you would need to get the template repeater object in script, traverse its repeating objects, and set their button background colours. You would need to clear them all first and then set the button that’s clicked to your colour
This might help to show you a breakdown of all components within an object (e.g. the template repeater component)
def printAllObjectComponents(object, indexPrefix = '', indent = ''):
components = object.getComponents()
for index, component in enumerate(components):
print "%s %s%s %s" % (indent, indexPrefix, index, component)
printAllObjectComponents(component, indexPrefix + str(index) + '.', indent + '\t')
using this, you can see that the templated objects are all contained within:
templateRepeater.getComponent(1).getComponent(0).getComponent(0)
(Area Alarms is the template I chose to repeat)
Then you can loop through this array and set the background colour of your buttons, for example:
if event.propertyName == 'refresh':
tr = event.source
templates = tr.getComponent(1).getComponent(0).getComponent(0).getComponents()
for template in templates:
label = template.getComponent('Label')
label.text = 'Bob'
Just keep in mind that the component index positions could possibly change in the future if IA decide to shuffle stuff around. You could mitigate this by looking for the template objects with inspiration taken from the printAllObjectComponents function
Also note, you will need to get a reference to the TemplateRepeater component from within one of the repeated templates first. You can do that using button.parent.parent… as many parents as you need to finally get to the templaterepeater object.
The easiest way is obviously not to go down this path and to instead use a tag 