Changing a property of a component from a tag value

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

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.

if event.propertyName=='tagValue':
	from java.awt import Color
	if event.source.tagValue==0:
	elif event.source.tagValue==1:
	elif event.source.tagValue==2:

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

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,