# Enabled/Disabled concern

**URL:** <https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586>\
**Category:** Ignition\
**Created:** [June 6, 2012, 2:32pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586 "2012-06-06T14:32:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 6, 2012, 2:32pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/1 "2012-06-06T14:32:00Z")

</div>

I am sure I am missing something here, but have a concern.

I have a flash video of this but it would not let me upload it, so I will try to explain it.

To duplicate:

Create a window with 2 buttons on it.  
Enable one button disable the other.  
Add some code to the mousePressed event of the buttons. Based on text I think you know which code I put on which button.

(For example: `system.gui.messageBox("From Button1 I am enabled so this should run")` and on other `system.gui.messageBox( "I am NOT enabled and should not run")`

Even when you click on the disabled button the code runs. If this code turned something on or off and a operator clicked on the button thinking it would have no effect because button is disabled on screen I think bad things could happen.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 6, 2012, 2:34pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/2 "2012-06-06T14:34:33Z")

</div>

This is on Ignition 7.4.1 (b906)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [June 6, 2012, 2:55pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/3 "2012-06-06T14:55:36Z")

</div>

Yes, that is true. Even if the component is disabled the mouse events fire. If you put the code on the actionPerformed than nothing would happen when it is disabled. If you want to keep the code on the mouse events your script can check to see if the component is enabled:[code]if event.source.enabled:

# do your code[/code]In 7.5, when you setup security you can disable all the events.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 6, 2012, 4:36pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/4 "2012-06-06T16:36:04Z")

</div>

Thanks, Travis

Is there an easy way to search for code on that event through projects?

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [June 6, 2012, 5:27pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/5 "2012-06-06T17:27:29Z")

</div>

If you use find and replace (Ctrl+F) within a project it will search the entire project for a line of code. This will only search the currently opened project, it will not search through projects that are not open.

---

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [June 7, 2012, 12:04pm UTC](https://forum.inductiveautomation.com/t/enabled-disabled-concern/4586/6 "2012-06-07T12:04:31Z")

</div>

Thanks, Greg

I seen that, was more looking for something that would say you have some code tied to this event so I could make sure it was nothing that should not run if it was disabled.
