Detecting Multiple Clicks

Paul Hibbert paul at livecode.org
Tue Jun 30 22:50:22 EDT 2015


Nice share.

Thank you Scott.

Paul

> On Jun 30, 2015, at 13:03, Scott Rossi <scott at tactilemedia.com> wrote:
> 
> Thought folks might find the following useful...
> 
> I currently have a situation where I need to detect multiple clicks on an
> object and differentiate between the number of click sets (i.e.
> single-click, double-click, triple-click, etc).  The following seems to
> work well, detecting a 50-click event, after which point I got tired of
> clicking :-)
> 
> -----
> 
> constant theClickThreshold = 300
> local theClickCount, theClickID
> 
> on mouseDown
>   if lineOffset("countClicks",pendingMessages()) = 0 then
>      put 0 into theClickCount
>   else cancel theClickID
>   add 1 to theClickCount
>   send "countClicks" to me in theClickThreshold millisecs
>   put the result into theClickID
> end mouseDown
> 
> command countClicks
>   put theClickCount && millisecs() -- SHOW CLICK COUNT
>   put 0 into theClickCount -- RESET
> end countClicks
> 
> -----
> 
> 
> The click threshold can be adjusted but seems to work well at 300
> milliseconds.  Change "on mouseDown" to "before mouseDown" to implement as
> a behavior.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list