Ignition Perspective OnClick for longer time

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?

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

onMouseDown:

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

onMouseUp:

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

Change Script on self.custom.mouseUp:

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")