Detecting Multiple Clicks
iowahengst at mac.com
Wed Jul 1 16:30:27 CEST 2015
Yes, thank you Scott.
> On Jun 30, 2015, at 9:50 PM, Paul Hibbert <paul at livecode.org> wrote:
> Nice share.
> Thank you Scott.
>> 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.
>> 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:
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode