Avoiding mouse polls
Thomas Rodriguez
thomas.rodriguez at free.fr
Sun Dec 15 07:47:01 EST 2002
Hello everyone, this is my first step in this mail-list :)
Ken, I do have some ideas about what you want to do. I recommend you
doing "idle-interception":
set the idle delay of Rev to some good value, which will be your
highlight delay, and implement something like this:
ObjectsList might be a comma-delimited string or an array
**********************************
global LastObjectHighlighted,ObjectsList,MouseWasClicked
on idle
if MouseWasClicked then
-- reactivate the loop now to avoid repeating bugs if ever the
target's script has any
put false into MouseWasClicked
-- do the click-commanded stuff, IE send a message to the
LastObjectHighlighted
send "DoMyStuff" to [object type] (item LastObjectHighlighted of
ObjectsList)
end if
-- clear current object highlight, if ever
send "UnHighlightMe" to [object type] (item LastObjectHighlighted of
ObjectsList)
-- check for last object and switch to next
if LastObjectHighlighted = number of items of ObjectsList then put 0
into LastObjectHighlighted -- 0 as we always add 1 after
add 1 to LastObjectHighlighted
-- here, highlight the next object
send "HighlightMe" to [object type] (item LastObjectHighlighted of
ObjectsList)
pass idle -- never to forget !
end idle
on mouseUp
put true into MouseWasClicked
end mouseUp
**********************************
Note that using custom properties causes a hard-drive access in most
cases AFAIK. Prefer global variables where you don't need to share data
with other objects/cards/stacks
Kind regards.
Thomas Rodriguez
oldtimer from the massive HyperCard users community worldwide :)
More information about the use-livecode
mailing list