mousemove crash
Brad Sampson
programmer711 at gmail.com
Wed Jan 10 18:23:56 EST 2007
If you are just using mouseMove as a handler that you want to be sent a lot
of times, I would suggest this. Also, if you are drawing a line, it might
be more stable just to use this script anyway, and just ignoring any
mouseLocs that are the same as the previous recorded mouseLoc.
on openStack
global backgroundMessageCount
add 1 to backgroundMessageCount
backgroundMessages
end openstack
on backgroundMessages
global backgroundMessageCount
add 1 to backgroundMessageCount
if backgroundMessageCount mod 50 is 0 then
-- Do whatever you need to here
end if
if backgroundMessageCount mod 1000 is 0 then
-- Do whatever else you need to here
end if
if backgroundMessages is not in the pendingMessages then send
pendingMessages to me in 1 millisecond
end backgroundMessages
This is just a sample script. The point of the backgroundMessageCount is
that you can have multiple scripts running at different rates.
For the example of substituting for a mouseMove script, I would use this:
on backgroundMessages
global backgroundMessageCount,theMouseLoc
add 1 to backgroundMessageCount
if the mouseLoc is not theMouseLoc then
put the mouseLoc into theMouseLoc
-- Do whatever you need to here
end if
if backgroundMessages is not in the pendingMessages then send
pendingMessages to me in 1 millisecond
end backgroundMessages
I hope it helps!
Brad
CMSEC
More information about the use-livecode
mailing list