When upgrading to 8.0.2 (from 7.9.2), I noticed that Momentary buttons look different when disabled. I’m curious if there is a way to override the text color similarly to how other components look. I found a couple threads that discussed this, but the solutions seem geared toward pre-8 versions of Ignition.
Here’s how I’d like the disabled text to appear:
Here’s how the Momentary button currently looks:
I believe the numeric text field and label components are setup in the UIManager to set their Synthetica.background.alpha when disabled, but I can’t figure out how to do the same for the Momentary button. I tried setting the Button.disabledText color in the UIManager using a client script, but that didn’t seem to change anything.
Thanks in advance for any help you can provide!
I think if I can add a change listener on DISABLED_BY_PERMISSIONS, I may be able to work around this limitation. Does anyone know if it is possible to add a change listener to the UIManager and recolor the text of momentary buttons this way?
I contacted support and they suggested I create a template with the button in it and add a property change script. Here’s the script I added:
from javax.swing.plaf import ColorUIResource
if event.propertyName == 'enabled':
if event.newValue == 1:
event.source.foreground = system.gui.color(0,0,0,255)
else:
event.source.foreground = ColorUIResource(128,128,128)
This seems to correct the problem. If you use the ColorUIResource function, it doesn’t seem to matter what RGB values you send in. I think it pulls the color from the UIManager based on the Look and Feel settings. If you want a specific color, rather than to match the other disabled objects, use system.gui.color.