Distinguish between single and double click

I’m working on my first project with Ignition, and using a tablet for the operator interface. I find it much more simple and quicker to navigate to my controls/setpoints pages with the single/double click.
When using a PC or other device I would normally use a left click/right click to display the relevant page.
The code that Witman posted solved the problem. Is it ok to reuse this same code on multiple objects on a page? or does the ‘singleClick’ variable need to be unique to each object?

I too am fairly new at Ignition, but I believe that event.source.putClientProperty() function is going to make the ‘singleClick’ variable unique to each event and therefore you should be able to ‘cut and paste’ the script.

Yes. I just ‘cloned’ a button then just changed the Windows that it navigated to. It worked just fine.

Yes, unique to the component the event came from.

event.source.putClientProperty('singleClick', True)

gives the same result as

event.source.singleClick = True

The difference is the former creates the custom property 'singleClick' on the event source component (component the event came from, in this case the button you clicked) for you at runtime (when the script is called) while the latter requires the event source component already has the 'singleClick' property defined.

2 Likes

I like the idea of being able to create a custom property at runtime. It could turn out to be very handy. Thanks.

@thomas.harvey Worth noting that you can create a custom property that is any type of object, including a function :slight_smile:
I’ve used this to create my own generic confirmation popup, and be able to pass an on yes and on no function to it so that I can use it anywhere. (the standard confirmation popup from system.gui.confirm buttons are far too small for touchscreen HMIs)

1 Like

This worked great, thanks!

1 Like

Any way to do this in perspective?

I want to bring up a different popup depending on whether a component is clicked or double clicked. But it seems to immediately pop up the single click pop-up at the first click