# Event collision onMouseDown and onDoubleClick

**URL:** <https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 30, 2025, 12:49pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092 "2025-09-30T12:49:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nazar](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@Nazar](https://forum.inductiveautomation.com/u/Nazar)\
**Post date:** [September 30, 2025, 12:49pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/1 "2025-09-30T12:49:41Z")

</div>

Hi everyone,

I am now making a device template in perspective and the template has an event onMouseDown which toggles an OPC tag. I also wanted to make a second event onDoubleClick to be able to open a pop-up view with the setups for this specific device. So I’ve encountered an issue, that the onMouseDown event is also triggered when I double click.

I wonder if there is a way to somehow prioritize the events?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 30, 2025, 1:08pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/2 "2025-09-30T13:08:00Z")

</div>

You can try using an onClick event, but I don't know if the framework is in place to prevent a double click from also triggering an onClick.

The onMouseDown event, isn't the proper place for something that you want to occur after a click (meaning both a mouseDown and mouseUp event occur). That a double click or even a single click trigger the onMouseDown is by design.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 30, 2025, 1:16pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/3 "2025-09-30T13:16:25Z")

</div>

Try this to understand what's going on:

- In Designer, create an event on the view or on a component.
- Add a script to `onMouseDown`, `onClick` and `onDoubleClick`.  
`system.perspective.print("onMouseDown"")`  
`system.perspective.print("onClick"")`  
`system.perspective.print("onDoubleClick"")`
- Start Designer's Preview Mode.
- Open Tools | Console.
- Now slowly test a single-click. You'll get,

```python
14:08:28.364 [Browser Thread: ...] INFO ... -- onMouseDown
14:08:28.420 [Browser Thread: ...] INFO ... -- onClick

```

- Note that the `onClick` event is logged on mouse release.
- Now test a double-click.

```python
14:10:38.745 [Browser Thread: ...] INFO ... -- onMouseDown
14:10:38.816 [Browser Thread: ...] INFO ... -- onClick
14:10:38.891 [Browser Thread: ...] INFO ... -- onMouseDown
14:10:38.994 [Browser Thread: ...] INFO ... -- onClick
14:10:38.995 [Browser Thread: ...] INFO ... -- onDoubleClick

```

This just confirms what you're seeing. I haven't thought of a fix yet. The double-click is announced 1 ms after the second onClick. (It may be different in a browser rather than a Designer.)

Note that, in general, window GUIs have to wait for mouse release to determine whether a click is part of a drag operation rather than a simple click, so the event is usually triggered on the button release. (This was a major slowdown when switching from DOS CAD systems to Windows as you had to click _and_ release on the control - way back!)

---

<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:** [September 30, 2025, 4:15pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/4 "2025-09-30T16:15:40Z")

</div>

As a project design pointer, you should try to avoid using one piece of interactive UI to accomplish multiple actions. At the very least, you should avoid “overlapping” actions

Think of a link or button on a web page. They accept only one click, or an alt-click (right click) and both of those different interactions perform different tasks. Trying to double-click a link will do nothing for you.

Either place a secondary piece of UI to open the popup, or use something like [onContextMenu](https://www.docs.inductiveautomation.com/docs/8.1/appendix/reference-pages/perspective-event-types-reference#:~:text=the%20script's%20logic-,onContextMenu,-Fired%20when%20the) to open your popup when the user right-clicks.

Alternatively, you could also use the built-in [context menu](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/working-with-perspective-components/perspective-component-properties#context-menu-item-types) props to handle this in a more “native” approach.

---

<div class="post-metadata">

**Author:** ![Nazar](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@Nazar](https://forum.inductiveautomation.com/u/Nazar)\
**Post date:** [October 1, 2025, 6:52am UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/5 "2025-10-01T06:52:46Z")

</div>

Thanks a lot for your answers! I wanted to avoid extra piece of UI (like a button) and was hoping to complete the task with multiple events.

The right click seems like a suitable option for a PC with a mouse. On a touch screen it might get a little bit complicated since the right click is associated with a “long” touch. I have some components that require to be pushed down to activate some devices functions like manual jogging of a motor. I will experiment with some of the ideas and post them in this topic.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 1, 2025, 9:41am UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/6 "2025-10-01T09:41:33Z")

</div>

> [@Nazar](#):
>
> I have some components that require to be pushed down to activate some devices functions like manual jogging of a motor

I hope you're not trying to do this in perspective. there are many topics on this on the forum about why this is doomed to fail and leave your jogging tag high

---

<div class="post-metadata">

**Author:** ![Nazar](https://avatars.discourse-cdn.com/v4/letter/n/e56c9b/32.png) [@Nazar](https://forum.inductiveautomation.com/u/Nazar)\
**Post date:** [October 13, 2025, 3:33pm UTC](https://forum.inductiveautomation.com/t/event-collision-onmousedown-and-ondoubleclick/111092/7 "2025-10-13T15:33:53Z")

</div>

So after trying different ways of completing my task I came to a conclusion that there is no possible way to make my idea work properly… Apparently I do need an extra UI component. Thank y’all for your help!
