# Momentary Button, Control Value and Mouse Clicks

**URL:** <https://forum.inductiveautomation.com/t/momentary-button-control-value-and-mouse-clicks/66861>\
**Category:** Ignition\
**Created:** [November 23, 2022, 4:36pm UTC](https://forum.inductiveautomation.com/t/momentary-button-control-value-and-mouse-clicks/66861 "2022-11-23T16:36:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmiCanuck](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hmiCanuck](https://forum.inductiveautomation.com/u/hmiCanuck)\
**Post date:** [November 23, 2022, 4:36pm UTC](https://forum.inductiveautomation.com/t/momentary-button-control-value-and-mouse-clicks/66861/1 "2022-11-23T16:36:39Z")

</div>

I have a momentary button that has its control value linked to an OPC tag. It appears that the button will toggle the OPC value when either mouse button is pressed.

Is there a way to limit the control value changes to only the left mouse click (not the right)?

---

<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:** [November 23, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/momentary-button-control-value-and-mouse-clicks/66861/2 "2022-11-23T16:45:08Z")

</div>

This post is a duplicate of your other post.

> [@Mouse Events using event.button1 and actionPerformed](https://forum.inductiveautomation.com/t/mouse-events-using-event-button1-and-actionperformed/66849):
>
> I have a confirmation dialog that uses a button. The button's event handler is mousePressed, which isn't terribly reliable when the operator is moving the cursor slightly at the same time as clicking. My solution was to move the code in actionPerformed instead. Since event.BUTTON1 isn't recognized in actionPerformed, how do I make sure that the script is only executed with the left mouse click?

It is against forum policy to post duplicates threads.

---

<div class="post-metadata">

**Author:** ![hmiCanuck](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hmiCanuck](https://forum.inductiveautomation.com/u/hmiCanuck)\
**Post date:** [November 23, 2022, 4:57pm UTC](https://forum.inductiveautomation.com/t/momentary-button-control-value-and-mouse-clicks/66861/3 "2022-11-23T16:57:07Z")

</div>

Sorry I'll post there. I thought this question was unrelated so I intentionally created a separate topic.

Feel free to delete this post.
