Problem with wait with messages

J. Landman Gay jacque at
Mon Jul 9 20:38:41 CDT 2007

David Bovill wrote:
> Ken - what you suggest works...
> but does wait with messages or wait for messages actually work? I have 
> never
> got it working - nor have I seen any example scripts with it working - and
> the docs etc all point to doing it "another way" :)

I've used it with success. In one project, I had a stack that needed to 
show frames of an animated gif under script control. It had to wait 
between frames for an amount of time that was passed to the handler in a 
parameter. But at the same time, a user needed to be able to do other 
things, like click a button or leave the card. So I used a repeat loop 
that would play the frames while checking simultaneously for user 
actions. A simplified excerpt was something like this:

repeat with x = tStart to tStop -- a frame range
  if gFlag = true then exit repeat
  set the currentframe of img 1 to x
  wait myVar milliseconds with messages -- allows user actions
end repeat

If the user clicked a button, a mouseup was sent normally (which is what 
the "with messages" part allows) and the button script executed at the 
same time the animation was running. Depending on the user action, the 
button script either set the global flag "gFlag" so that the repeat loop 
would stop, or did something else while the looping continued.

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the use-livecode mailing list