Repeatloop in mouseDown handler wont end

Jan Schenkel janschenkel at yahoo.com
Tue Oct 15 06:32:01 EDT 2002


--- Michael Kristensen <michael-kristensen at dsa-net.dk>
wrote:
> Hi all
> 
> There is a very annoying bug that show itself in
> both my own stacks and 
> in Revolutions UI.
> 
> Its in mouseDown handlers with a repeatloop like
> this:
> 
> on mouseDown
>     --script
> repeat while the mouse is down
>     --script
> end repeat
> end mouseDown
> 
> 
> In appr. 1 out of 5 times the repeatloop wont end.
> 
> It can also be seen in the Object Property Palette
> where
> it will happen in one of the four move-buttons.
> 
> Nothing can stop the repeatloop except  to kill
> Revolution.
> 
> 
> 
> Kind regards
> Michael Kristensen 
> 

Hi Michael,

It has to do with the moment the state of the mouse is
checked. Maybe you could rescript your button so that
it uses the mouseRelease event ?
Example:

on mouseDown
  send "updateMe" to me in 50 milliseconds
  -- or however quick you like
end mouseDown

on mouseRelease
  if "updateMe" is in the pendingMessages then
    cancel "updateMe"
  end if
end mouseRelease

on updateMe
  -- do your stuff here
  -- ...
  -- now call yourself however quick you like
  if "updateMe" is not in the pendingMessages then
    send "updateMe" to me in 50 milliseconds
  end if
end updateThings

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



More information about the Use-livecode mailing list