Cannot coerce value 'false' into type: class java.awt.Color when trying to change value bound background color

Hello,

I have quite a few One Shot Buttons in a window, the background colors are based on a bound value that I already have it set up and it works. BUT I want to CHANGE the color of the background.

When I try to change the color I get the error "Cannot coerce value 'false' into type: class java.awt.Color"

I change it by double clicking on the color, green for example, and selecting a new color. Once I click ok on the binding property window I get the error.

I mean, I already changed the colors the first time I set it up, I'm not sure what I'm doing wrong now. Happens to all the buttons that I type to change the color on.

Can you paste the entire contents you get if you click 'full' on the details of the error message?

You might need to upgrade. This seems like a bug I remember fixing.

Here's the full error message.

java.lang.ClassCastException: Cannot coerce value 'false' into type: class java.awt.Color
at com.inductiveautomation.ignition.common.TypeUtilities.coerce(TypeUtilities.java:1493)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.setQValue(AbstractPropertyAdapter.java:223)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.setQValue(SimpleBoundTagAdapter.java:259)
at com.inductiveautomation.factorypmi.application.binding.AbstractPropertyAdapter.updateValue(AbstractPropertyAdapter.java:269)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.notifyTagChanged(SimpleBoundTagAdapter.java:518)
at com.inductiveautomation.factorypmi.application.binding.SimpleBoundTagAdapter.tagChanged(SimpleBoundTagAdapter.java:506)
at com.inductiveautomation.ignition.client.tags.impl.ClientTagSubscriptionManager$ListenerDeliveryManager.edtDeliver(ClientTagSubscriptionManager.java:603)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.1.11 (b2021101912)
Java: Azul Systems, Inc. 11.0.11

What happens if you bind the tag to abither custom prop which converts it to an int, and use that in your colour binding instead? (just as something to try, obviously this shouldn't be necessary)

Sorry, could you tell me how to do that?

I just started manually replacing each button. 12 down, 418 to go... The error only starts occurring once I bind a value to Background Color and then try to change the tag to a different tag or change the color.

Before you do that, I'd try your project on a newer version of Ignition.

I've already reached out to our engineer to try and get permission to upgrade. It will probably be faster for me to manually redo each button than to wait for the wheels of bureaucracy to turn... we'll see.

1 Like

Ask them to manually configure 430 buttons individually? :laughing:

That would be much much slower... :laughing:

Maybe you're finished already, but if it was me, I'd be replacing all of those magic colours with something global like using vision client tags to hold colours, or a dataset tag to hold a table of colours and then use the lookup expression function to lookup the tag value and return the appropriate colour from the dataset tag

1 Like

Thanks, I'll look into that for future reference. I'm rather new to Ignition and not very far into InductiveUniversity.