# Changing a property of a component from a tag value

**URL:** <https://forum.inductiveautomation.com/t/changing-a-property-of-a-component-from-a-tag-value/37056>\
**Category:** Ignition\
**Created:** [July 24, 2020, 3:38pm UTC](https://forum.inductiveautomation.com/t/changing-a-property-of-a-component-from-a-tag-value/37056 "2020-07-24T15:38:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![patricia.mendez](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@patricia.mendez](https://forum.inductiveautomation.com/u/patricia.mendez)\
**Post date:** [July 24, 2020, 3:38pm UTC](https://forum.inductiveautomation.com/t/changing-a-property-of-a-component-from-a-tag-value/37056/1 "2020-07-24T15:38:47Z")

</div>

Dear supporters,

what is the best way of doing that the fillPaint property of a square component changes when a certain tag value also changes?. Basically this means that I want to bind the color of the property to a tag but via a script and not using the wizard that binds the color to a certain tag directly. I want to program it.  
Is this done through the “client tag change script”?. If so, how to reference the property I mention (fillPaint) which belongs to a component (let’s call it sqr1) into the tag change script?  
Thanks a lot for your help  
Cheers  
Patricia

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 24, 2020, 6:00pm UTC](https://forum.inductiveautomation.com/t/changing-a-property-of-a-component-from-a-tag-value/37056/2 "2020-07-24T18:00:53Z")

</div>

I would create a custom property on the square and bind it to the tag.  
Then in the propertyChange event of the square set the color based on the value of the custom property.

```auto
if event.propertyName=='tagValue':
	from java.awt import Color
	if event.source.tagValue==0:
		event.source.setFillPaint(Color.red)
	elif event.source.tagValue==1:
		event.source.setFillPaint(Color.green)
	elif event.source.tagValue==2:
		event.source.setFillPaint(Color.yellow)
	else:
		event.source.setFillPaint(Color.blue)

```

You can of course put the values and colors into a dictionary and lookup that way, or a list, etc.

---

<div class="post-metadata">

**Author:** ![patricia.mendez](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@patricia.mendez](https://forum.inductiveautomation.com/u/patricia.mendez)\
**Post date:** [July 27, 2020, 2:05pm UTC](https://forum.inductiveautomation.com/t/changing-a-property-of-a-component-from-a-tag-value/37056/3 "2020-07-27T14:05:51Z")

</div>

Thank you so much for your help. I have applied your idea to my case and it has nicely worked.

Have a nice day and thanks again,  
Patricia
