[ANN] [EN] [FR] Tutorial #27 by So Smart Software: How to select objects using a selection rectangle built on-the-fly

Richard Gaskin ambassador at fourthworld.com
Tue Aug 12 16:53:05 EDT 2008


Eric Chatonet wrote:
> I love principles but I need to see...
> In this case, I'm unable to see worrying side effects.

In OS X, open Activity Monitor and set it to view processor usage, then 
run this in a button with the mouse held down:

on mouseDown
   repeat until the mouse is "up"
     get 1+1
   end repeat
end mouseDown

Here, processor usage spikes to about 80% or more for one of the two 
processors on board.  In some contexts this may not matter, but for 
others it may be important.


> Of course, mouseMove could certainly be used to achieve the same goal.
> With less precision because it's sent every 200 ms only, but why not.

I would double-check that.  Here, the mouseMove message seems to be sent 
  very frequently while the mouse is in motion, much more than just 5 
times a second (200ms).

This quickie test yields times of about 12-17ms per mouseMove message 
while the mouse is down and being moved around (MacBook Pro, 2.16GHz):


local sDown, sT, sTT

on mouseDown
   put true into sDown
end mousedown

on mouseMove   x, y
   if sDown is true then
     if sT is empty then put the millisecs into sT
     put the millisecs - sT &cr after sTT
     put the millisecs into sT
   end if
   pass mouseMove
end mouseMove


on mouseUp
   put empty into sdown
   put sTT
end mouseUp

on mouseRelease
   put empty into sDown
   put sTT
end mouseRelease



-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list