# Pass through mouse clicks

**URL:** <https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080>\
**Category:** Ignition\
**Created:** [May 17, 2018, 7:19pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080 "2018-05-17T19:19:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 17, 2018, 7:19pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/1 "2018-05-17T19:19:35Z")

</div>

Does anyone have a good method of passing through a click to objects behind the first? Basically I have a couple of layers of paintable canvases that draw items on themselves - I want to be able to click and check the first layer for something, if nothing to click then go to the next, etc.

I’m thinking right now to have a top layer that will individually query each paintable canvas via a custom function on each canvas, which I think would work alright, but I was wondering if there was any other method thats cleaner than this.

---

<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:** [May 17, 2018, 7:58pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/2 "2018-05-17T19:58:19Z")

</div>

Look at Kyle's suggestions here:

> [@Button Events Within Templates](http://forum.inductiveautomation.com/t/button-events-within-templates/14382/17):
>
> Here is how I do it. from java.awt.event import MouseEvent evt = MouseEvent(event.source.parent.parent,event.getID(),event.getWhen(),event.getModifiers(),event.x,event.y,event.clickCount,event.popupTrigger,event.button) event.source.parent.parent.dispatchEvent(evt) We take the originating event, from a label inside the template, and create a new instance of the mouse event, only changing the source. If we do not do this, then event.source will be equal to the triggering component inside the t…

Probably just need some coordinate transformations to go the other way.

---

<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:** [May 17, 2018, 8:26pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/3 "2018-05-17T20:26:37Z")

</div>

> [@pturmel](#):
>
> Probably just need some coordinate transformations to go the other way.

If you do, protip: [https://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#convertPoint(java.awt.Component,%20int,%20int,%20java.awt.Component)](https://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#convertPoint(java.awt.Component,%20int,%20int,%20java.awt.Component))

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 17, 2018, 8:57pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/4 "2018-05-17T20:57:36Z")

</div>

Where has this been all my ignition life! Thanks, looks very nice.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 17, 2018, 9:00pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/5 "2018-05-17T21:00:16Z")

</div>

Nice! Looks much better than my weird solution.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [May 18, 2018, 8:43pm UTC](https://forum.inductiveautomation.com/t/pass-through-mouse-clicks/18080/6 "2018-05-18T20:43:30Z")

</div>

I thought I could switch some of the layers I had over to template canvas layouts and I could have sworn I had confirmed earlier that if you click on an ‘empty’ part of a template canvas that it would just go through and the mouse event would go to the next layer, this does not seem to be the case. Is there something I’m missing here?
