I want a doubleclick, not a singleclick

Chipp Walters chipp at chipp.com
Sun Jul 31 00:33:26 EDT 2005


I looked through the archives and didn't see an answer to this one-- so 
I thought I'd post my own :-)

If you have both a mouseUp and mouseDoubleUp handler in a single button 
script, both will be executed when you double-click the button.

But, what if you only want the mouseDoubleUp to execute and NOT the 
mouseUp? Well, I chatted this eve with Ken Ray and Jan Schenkel and came 
up with the following (they both had a bit of a different spin on it, 
perhaps they'll elaborate).

Here's the guts:

local lDoubleClick

on mouseUp
   send "doClick" to me in (the doubleClickInterval) milliseconds
end mouseUp

on mouseDoubleUp
   put true into lDoubleClick
end mouseDoubleUp

on doClick
   if lDoubleClick = true then
      --> doDoubleClickstuff
     put false into lDoubleClick
   else
     --> doSingleClickStuff
   end if
end doClick

best,

Chipp



More information about the use-livecode mailing list