Change color through binding expressions

I want to change the color of an object through a binding expression
it is possible?

I was thinking in a code like this

if({Close_Tag}&&!{Open_Tag})= true
{New Template.Rectangle 1.fillPaint} = color (255,0,0,[0])

but this doesn’t must be my sintax I’ll appreciate the help

Yes, the syntax was a bit off. See if - Ignition User Manual 8.0 - Ignition Documentation. The required syntax is if(condition, trueReturn, falseReturn). Note the closing parenthesis for the if statement comes after everything else, not after condition. You don’t need “= true”, and the if expression requires values to return for both true and false, with condition and the two returns separated by commas. It returns the value that will be bound to the property you put the binding on; you don’t reference the property in the binding.

Put this in New Template.Rectangle 1.fillPaint expression binding (don’t include New Template.Rectangle 1.fillPaint in the expression):

if({Close_Tag} && !{Open_Tag},
	// Use this color when true.
	color (255,0,0,0),
	// Use this color when false
	color (255,0,0,0)

P.S. Make posted code easy to read by enclosing it in triple back ticks ``` on a line above and below–or use the preformatted text button: image

Thanks man that work perfect.

1 Like