Status Window Questions

David Egbert degbert at mac.com
Mon Sep 6 19:26:24 EDT 2004


Thanks Trevor,

It works great!

I also wasn't aware of Script Local Variables (You can declare them at 
the beginning of a script and all the handlers in the script can 
recognize them).  Cool stuff!

Thanks again.

--
Dave Egbert


On Sep 6, 2004, at 4:29 PM, Trevor DeVore wrote:

> 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
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list