Interrupting a loop

Dar Scott dsc at swcp.com
Tue Feb 17 20:21:54 EST 2004


On Tuesday, February 17, 2004, at 04:48 PM, Graham Samuel wrote:

> I'm not sure how to handle the temporary exit from the repeat loop so 
> as to be able to come back to it when 'resume' is triggered.

My primer stack on message mechanics (at my web site) includes an 
example of a "background" task.  It uses a purposefully tedious method 
for inverting an image and displaying progress.  The example shows both 
the "normal" method and the "background" method.  I think the approach 
for background will apply.  It does require breaking the task into 
steps (or states).

The example does not have the pause and restart builtin as is, but the 
structure is there to allow it.  The example illustrates other things 
such as switching cards going on at the same time, so a pause button 
click will be seen.

The wait with/for messages might be in an alternate method.

Take care that you don't crowd out events with too heavy of pending 
messages.

In some cases the hardest part is converting a task to a series of 
tasks.  This is hard if the work is not homogeneous and inner loops are 
of all kinds and of all sizes and depths.

Dar Scott

****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list