# Message handler on button is disabled when button is not enabled

**URL:** <https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [February 16, 2023, 6:40pm UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955 "2023-02-16T18:40:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 16, 2023, 6:40pm UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/1 "2023-02-16T18:40:23Z")

</div>

We've found the availability of tooltips on touch screens quite useful for some things and recently added a pseudo background dismiss by sending a message from clicks on root that is received by components with tips and clears their tooltips. It works great, except disabled buttons ignore the message.

We can put this script on the button's parent (editing reference to button child) and it works to remove the button tip while button is not enabled. But this script on the button does not work when button is not enabled:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/73fecc13e0d65f27b21d29d88595b3f5706e002e.png)

Is disabling message handlers on disabled buttons intentional or a bug?

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [February 17, 2023, 4:09am UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/2 "2023-02-17T04:09:58Z")

</div>

Hello,

Could you not setup an expression binding on the tooltip text to be blank if the button is not enabled instead of using message handlers? Seems like it may be much simpler to manage.

> if(this.custom.props.enabled,"My Tooltip Text","")

It also seems that if your message handler name is generic like "remove-tooltip" all buttons with this generic message handler in your page scope will receive and react to a message from a single button message even if it is not from the respective button.

Frank

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 17, 2023, 4:37am UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/3 "2023-02-17T04:37:15Z")

</div>

> [@franklepkowski](#):
>
> if your message handler name is generic like "remove-tooltip" all buttons with this generic message handler in your page scope will receive and react to a message

Yes, this is the goal (dismiss all tooltips when background is tapped) and it works. The surprise was to find that message handlers on buttons are apparently disabled when buttonComponent.enable is not true.

Our application is displaying sensor IDs and names in a tooltip when tapped on touch screens as well as showing interlocks preventing action when hand controls are tapped. Operators like it, but noted sometimes they want to get the tip out of the way immediately. Now they can tap anywhere else and tips are dismissed. Our problem is solved, but it seems like message handlers probably should not be disabled on a button component just because the button is not enabled.

---

<div class="post-metadata">

**Author:** ![franklepkowski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/franklepkowski/32/4808_2.png) [@franklepkowski](https://forum.inductiveautomation.com/u/franklepkowski)\
**Post date:** [February 17, 2023, 5:10am UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/4 "2023-02-17T05:10:04Z")

</div>

Ahh, I see what you’re doing. I like the idea!

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 17, 2023, 7:16am UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/5 "2023-02-17T07:16:31Z")

</div>

I was unable to replicate this in 8.1.23 (I just happened to have this version up at the time). I've attached the resource I used to test the following scenario:

1. Request the `Target` button display a tooltip.
2. Disable the `Target` button.
3. Request the `Target` button remove its tooltip.

Please examine the View resource and identify what I have done differently from your resource (aside from names of scripts, obviously) and then reply here.

Note: I also tested on the button while it was disabled for the entire test and the message handlers continued to operate as if the button was enabled.

[Replication.zip](https://forum.inductiveautomation.com/uploads/short-url/qKWd8vIGZZ2MoZALjpeoUp4j4af.zip) (6.3 KB)

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 17, 2023, 5:51pm UTC](https://forum.inductiveautomation.com/t/message-handler-on-button-is-disabled-when-button-is-not-enabled/69955/6 "2023-02-17T17:51:50Z")

</div>

Thanks for looking at this. I'm sorry for the false alarm. Looking at this again today I realized my working message handler (on parent) was "remove-tooltip **s**" while the one that didn't work on buttons was "remove-tooltip" (missing final **s** ). We are sending a "remove-tooltip **s**" message from tap on background.
