# Dispatch mouse event to template instance

**URL:** <https://forum.inductiveautomation.com/t/dispatch-mouse-event-to-template-instance/55298>\
**Category:** Ignition\
**Created:** [January 24, 2022, 7:55am UTC](https://forum.inductiveautomation.com/t/dispatch-mouse-event-to-template-instance/55298 "2022-01-24T07:55:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Terraneo](https://avatars.discourse-cdn.com/v4/letter/f/f9ae1b/32.png) [@Francesco\_Terraneo](https://forum.inductiveautomation.com/u/Francesco_Terraneo)\
**Post date:** [January 24, 2022, 7:55am UTC](https://forum.inductiveautomation.com/t/dispatch-mouse-event-to-template-instance/55298/1 "2022-01-24T07:55:02Z")

</div>

Hello,  
I’m trying to dispatch a mouseClicked event to the template instance, this is the code:

```auto
from java.awt.event import MouseEvent
evt = MouseEvent(
		 event.source.parent
		,event.getID()
		,event.getWhen()
		,event.getModifiers()
		,event.x
		,event.y
		,event.clickCount
		,event.popupTrigger
		,event.button)
event.source.parent.dispatchEvent(evt)	

```

In my template there is only one component, this code is defined in mouseClicked event of the component and in mouseClicked event of the template.  
The code is working correctly when I toggle the designer preview mode, but not from the client runtime.

Any suggestion?

Platform: Ignition 8.1, Vision.
