Was looking for a way to get a click count on a perspective event. I saw some discussion on event.clickCount but this property doesn’t appear to be available in Perspective. I did find a property at event.detail that appears to count the clicks. I can’t find any documentation on this property, so I just wanted to run this out here to make sure I’m not using something bad or will soon be going away.
Any input on the event.detail property?
I think you’re looking to place some logic into the onClick Event for Perspective components. Perspective Events are something you configure yourself. Right-click any Perspective component, then select “Configure Events”. Under
Mouse Events you’ll find several different events you can hook into.
Understood, thanks. I just have a situation where I need an onClick and an onDoubleClick. I needed a way to try to differentiate the two as the onClick was executing in addition to the onDoubleClick. I’m using messages to hold the onClick to see if I get a double click.
Of course, now that I’m thinking about it again, I could have used a message to hold the onClick then just set a property when the onDoubleClick happened… This may need a little further testing…
What about using just the onClick event to increment a custom property something like “clickCount” then create a change event for that property that will check if the property is greater than 1 after a predefined delay representing your time rang for a double click. I am still learning perspective so i am not sure if that’s any better than your approach, but it does appear to work.
Thank you, I wasn’t thinking in that mindset at the time, but that should work. Again not sure if event.detail is undocumented because it is going away or some other reason, but I may switch to setting a property on the double click as I’m setting one anyway to to help manage this. Thanks.
Where are you seeing event.detail? I’m not familiar with that property.
I was adding an onClick event on a label. I found it by saving event to a property in the script to see what was there. Was originally looking to see if clickCount was there.
It looks like that property might indeed count the number of clicks for the current mouse event, BUT that means that you’d still have no way of knowing whether the value you’re getting is the final value as
event.detail will have values of 1, 2, and 3 if a user triple-clicks a component because the Event will fire 3 times.
What’s the use-case here? It seems like questionable design to place something which could either be clicked one time or multiple times and have different behaviors based on the number of times it was clicked.
I have a need to have both a single click and a double click function on a event tied to a label field. I have this functioning well using the event.detail and event messages, but may adjust to just set a property when I have some extra cycles.