# Script on Group of Components (onClick)

**URL:** <https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [November 22, 2023, 1:01pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249 "2023-11-22T13:01:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 22, 2023, 1:01pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249/1 "2023-11-22T13:01:04Z")

</div>

I've got a few different groups, each with a few components in it.

I've configured an on-click script for entire groups at the group level.

Clicking on a blank portion of the group executes the script (navigation). However, for some groups clicking on an actual component in the group does not execute the script, and yet for others it does.

What gives? How can I make sure it executes?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 22, 2023, 1:17pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249/2 "2023-11-22T13:17:52Z")

</div>

You cannot. Java Swing does not propagate events to all containing components. The innermost component under the mouse that has a **listener defined** will consume the event.

The hierarchy shown in the script event editor indicates which events share a common listener type, and therefore count as a listener for the group of event types.

Consider moving the script to a project library and adding a call to it to all inner components that have a listener.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 22, 2023, 1:22pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249/3 "2023-11-22T13:22:47Z")

</div>

But then why does it work for some components in one group, but not another instance of the same component in a different group?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 22, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249/4 "2023-11-22T13:26:21Z")

</div>

Not sure. Note that tooltips are implemented with internal mouse listeners. That's caught me a couple times.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 22, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/script-on-group-of-components-onclick/82249/5 "2023-11-22T13:26:52Z")

</div>

That's probably it then. That's the only difference. The one that does work doesn't have a tooltip on it.
