# Ignition Perspective OnClick for longer time

**URL:** <https://forum.inductiveautomation.com/t/ignition-perspective-onclick-for-longer-time/71655>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 27, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-onclick-for-longer-time/71655 "2023-03-27T16:34:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sancklerck](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@Sancklerck](https://forum.inductiveautomation.com/u/Sancklerck)\
**Post date:** [March 27, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-onclick-for-longer-time/71655/1 "2023-03-27T16:34:52Z")

</div>

Hello, i need the same button to have 2 functions, one if the user click for \<= .5 seconds print "normal click", and another one if the user press the button for more than (\>) .5 seconds let's say, then print "long click", any ideas on how to complete this idea?

---

<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:** [March 27, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-onclick-for-longer-time/71655/2 "2023-03-27T17:31:11Z")

</div>

To get this sort of functionality you'll need to include use of onMouseDown and onMouseUp Events.

**onMouseDown:**

```auto
def runAction(self, event):
	import time
	self.custom.mouseDown = time.time()

```

**onMouseUp:**

```auto
def runAction(self, event):
	import time
	self.custom.mouseUp = time.time()

```

**Change Script on `self.custom.mouseUp`:**

```auto
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if currentValue and currentValue.value:
		if (currentValue.value - self.custom.start) < 0.5:
			system.perspective.print("normal click")
		else:
			system.perspective.print("long click")

```
