# Keep Font Dark on Component When 'Events Disabled'

**URL:** <https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940>\
**Category:** Ignition\
**Created:** [July 31, 2017, 6:04pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940 "2017-07-31T18:04:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dws2384](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dws2384](https://forum.inductiveautomation.com/u/dws2384)\
**Post date:** [July 31, 2017, 6:04pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/1 "2017-07-31T18:04:13Z")

</div>

I have some components. That I have disabled events on. This is working fine and doing what I want it to. However, it now makes the font a light gray. Is there a way to keep it looking as it does when events are enabled. These buttons also contain information about the devices (serial numbers, rack location, etc) and it is now hard to read

Thanks

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 31, 2017, 6:24pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/2 "2017-07-31T18:24:35Z")

</div>

On `propertyChange` of the components, try this. Alternately, put it on the window’s visionWindowOpened to apply to all the components that may get disabled.

```auto
if event.propertyName == 'enabled':
	from java.awt import Color
	event.source.setDisabledTextColor(Color(0, 0, 0))

```

---

<div class="post-metadata">

**Author:** ![dws2384](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dws2384](https://forum.inductiveautomation.com/u/dws2384)\
**Post date:** [August 2, 2017, 3:05pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/3 "2017-08-02T15:05:44Z")

</div>

Thanks, doesnt seem to work in the propertyChange though. I would like to have it working there as the object it is a template used throughout the project and I can change it once. I have hundreds of windows that would need to have this added to if visionWindowOpened is required to have it

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 2, 2017, 3:42pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/4 "2017-08-02T15:42:19Z")

</div>

Make sure you test in a full client, or at least in preview mode in the designer - propertyChange events don’t fire while in design mode.

---

<div class="post-metadata">

**Author:** ![dws2384](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dws2384](https://forum.inductiveautomation.com/u/dws2384)\
**Post date:** [August 2, 2017, 3:44pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/5 "2017-08-02T15:44:34Z")

</div>

I tested it in the full client. doesnt seem to work. Can I use this script on the container of the template or do i need to go into each label and specify the color there?

---

<div class="post-metadata">

**Author:** ![dws2384](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@dws2384](https://forum.inductiveautomation.com/u/dws2384)\
**Post date:** [August 2, 2017, 3:45pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/6 "2017-08-02T15:45:36Z")

</div>

> [@paul-griffith](#):
>
> if event.propertyName == 'enabled':  
> from java.awt import Color  
> event.source.setDisabledTextColor(Color(0, 0, 0))

Traceback (most recent call last):  
File "event:propertyChange", line 3, in   
AttributeError: '[com.inductiveautomation.factorypmi.application.com](http://com.inductiveautomation.factorypmi.application.com)' object has no attribute 'setDisabledTextColor'

Ignition v7.9.0 (b2016101208)  
Java: Oracle Corporation 1.8.0\_141

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 2, 2017, 3:45pm UTC](https://forum.inductiveautomation.com/t/keep-font-dark-on-component-when-events-disabled/14940/7 "2017-08-02T15:45:46Z")

</div>

This would have to go into each component that’s getting enabled or disabled - or, if you’re enabling/disabling the container, `event.source.setDisabledTextColor(Color(0, 0, 0))` will have to be `event.source.getComponent("label").setDisabledTextColor(Color(0, 0, 0))`
