Status Window Questions
Trevor DeVore
lists at mangomultimedia.com
Mon Sep 6 18:29:59 EDT 2004
On Sep 6, 2004, at 3:14 PM, David Egbert wrote:
> I'm trying to implement a status window in an app I'm building.
>
> I'd like to user to click a "Process" button and have the app open a
> status window indicating the status of the stuff they are processing
> (with a progress bar, cancel button, and other useful information).
> The main script for the processing is located in a sub stack where the
> main interface is located. I thought I could just open the status
> stack, have a button on that stack that sets a global to cancel the
> process, and have the processing script check the global each time it
> processes an item. Here's basically what the processing script looks
> like:
>
> repeat with x = 1 to theNumberOfItems
> global gCancelStuff
> processStuff theItem
> if gCancelStuff is true then exit to top
> end repeat
>
> The problem is the script prevents all interaction to buttons until it
> has completed processing all of the items. Is there a way to script it
> so the Cancel button can be clicked (and the process aborted)? Is
> there an example stack somewhere I can learn from?
Dave,
Maybe try using send rather than a repeat loop. Something like the
following may give you the results you are after.
local sNumberOfItems
local sItemCounter
on startProcessing
--> SET UP COUNTERS
put 20 into sNumberOfItems
put 0 into sItemCounter
send "processStuff" to me in 0 seconds
end startProcessing
on processStuf
add 1 to sItemCounter
-- do stuff to item sItemCounter
if sItemCounter < sNumberOfItems AND gCancelStuff <> true then
send "processStuff" to me in 10 milliseconds
end if
end processStuff
--
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com
More information about the use-livecode
mailing list