# Vision: Button Template

**URL:** <https://forum.inductiveautomation.com/t/vision-button-template/111425>\
**Category:** Ignition\
**Tags:** vision, ignition81\
**Created:** [October 14, 2025, 9:52am UTC](https://forum.inductiveautomation.com/t/vision-button-template/111425 "2025-10-14T09:52:06Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [October 14, 2025, 3:47pm UTC](https://forum.inductiveautomation.com/t/vision-button-template/111425/7 "2025-10-14T15:47:46Z")

</div>

For another approach, you can lean on our built in `EventDelegateDispatchers` class to automatically forward events (of certain types/all types) from a child component to a parent component provided by reference, i.e.

```python
from com.inductiveautomation.ignition.client.util.gui import IgnitionSwingUtilities
from com.inductiveautomation.vision.api.client.components.model import TopLevelContainer
from com.inductiveautomation.factorypmi.application.components.util import EventDelegateDispatcher

KEY_EVENT_MASK = EventDelegateDispatcher.KEY_EVENT_MASK
MOUSE_EVENT_MASK = EventDelegateDispatcher.MOUSE_EVENT_MASK
FOCUS_EVENT_MASK = EventDelegateDispatcher.FOCUS_EVENT_MASK
ALL_EVENTS_MASK = EventDelegateDispatcher.ALL_EVENTS_MASK

def addForwardingEventListener(event, startSource = None, mask = ALL_EVENTS_MASK):
	startSource = event.source if startSource is None else startSource		
	parent = IgnitionSwingUtilities.getAncestorOfClass(TopLevelContainer, startSource.parent)
	EventDelegateDispatcher.initializeDispatchers(startSource, parent, mask)

```

> **[EventDelegateDispatcher](https://files.inductiveautomation.com/sdk/javadoc/ignition83/8.3.0/com/inductiveautomation/factorypmi/application/components/util/EventDelegateDispatcher.html)**
>
> declaration: package: com.inductiveautomation.factorypmi.application.components.util, class: EventDelegateDispatcher

The class internally does the event cloning + adjusts cursor points as necessary.

For a smaller refactor, you could also probably use something from Java's `SwingUtilities` to ease the mouse event translation, e.g:

> **[SwingUtilities (Java SE 21 & JDK 21)](https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/SwingUtilities.html#convertMouseEvent(java.awt.Component,java.awt.event.MouseEvent,java.awt.Component))**
>
> declaration: module: java.desktop, package: javax.swing, class: SwingUtilities

---

_[View the full topic](https://forum.inductiveautomation.com/t/vision-button-template/111425)._
