mouseUp question

larry at significantplanet.org larry at significantplanet.org
Thu Aug 7 01:12:52 EDT 2014


Hi Terry,
You put me on the right track.
I'm sure your script below would work, but I don't like messing with pendingMessages, so I did the following:

global myClick



on mouseUp

put 1 into myClick

send soundChoice to me in .3 seconds

end mouseUp



on mouseDoubleUp

put 2 into myClick

soundChoice

end mouseDoubleUp



on soundChoice

   if myClick = 1 then

      put the hilitedtext of field allMySounds into thisSound

      play ac thisSound

   end if

   if myClick = 2 then

     put return & the hilitedtext of field allMySounds after field eventSounds

     sort field eventSounds

     if line 1 of field eventSounds is empty then delete line 1 of field eventSounds

     put 3 into myClick  -- SO IT DOESN'T PUT IT IN TWICE

   end if

end soundChoice





Thanks for your help!

Larry





----- Original Message ----- 
From: "Terry Judd" <terry.judd at unimelb.edu.au>
To: "How to use LiveCode" <use-livecode at lists.runrev.com>
Sent: Wednesday, August 06, 2014 10:28 PM
Subject: Re: mouseUp question


> Hi Larry, one approach is to do something like the code below, which
> delays the mouseUp handler from running until after the doubleClick
> interval has expired. You can adjust the double-click interval to be
> whatever you like (shorter times will cause less obvious delays in the
> mouseUp handler running).
> 
> on mouseUp
>    send "doStuff" to me in (the doubleClickInterval)+1 millisecs
> end mouseUp
> 
> on doStuff
>    put "mouseUp"&cr after fld 1
> end doStuff
> 
> on mouseDoubleUp
>    repeat for each line tMessage in the pendingMessages
>        if tMessage contains "doStuff" then cancel (item 1 of tMessage)
>    end repeat
>    put "mouseDoubleUp" &cr after fld 1
> end mouseDoubleUp
> 
> Terry...
> 
> 
> 
> On 7/08/2014 2:11 pm, "larry at significantplanet.org"
> <larry at significantplanet.org> wrote:
> 
>>In a field I have two scripts - one for mouseUp and another one for
>>mouseDoubleUp
>>
>>When the user clicks a line in the field (mouseUp) it plays the .wav file
>>they click on
>>
>>When the user double clicks it copies the .wav file to another field.
>>
>>The problem is that LC runs BOTH scripts when the user dbl clicks.
>>There is the small delay of time after the first click and before the
>>second click.
>>
>>How do I get LC to ignore mouseUp when the user dbl clicks??
>>
>>TIA
>>Larry
>>_______________________________________________
>>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
> 
> 
> _______________________________________________
> 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