Fixed: Quitting a standalone and saving open stacks

Bill Vlahos bvlahos at mac.com
Sun Apr 20 23:34:36 EDT 2008


I was able to make it work by adding an additional quit statement  
after the repeat loops.

on shutdownRequest
   put the openStacks into vOpenStacks
   filter vOpenStacks with "*.ifw"
   if the number of lines in vOpenStacks > 0 then
     repeat for each line tLine in vOpenStacks
       close stack tLine
     end repeat
     quit -- this is needed to also quit the standalone in Windows
   end if
   pass shutdownRequest
end shutdownRequest

So the extra Quit simply makes the standalone go through the filtered  
openStacks again which is very fast because there aren't any more open.

Thanks to Sarah, Ken, and Trevor for help with this.

Bill Vlahos

On Apr 20, 2008, at 11:18 AM, Bill Vlahos wrote:

> I have a standalone which opens other stacks that contain data.  
> There is a closeStack handler in each data stack that checks to see  
> if the stack needs to be saved and prompts the user. This works fine  
> if the user clicks the close window button but I also need to catch  
> this if the user selects Quit.
>
> Trevor suggested that I put the shutdownRequest handler into a front  
> script which works. I put the shutdownRequest script in a hidden  
> button on the standalone and make it a front script. If I don't do  
> that it puts up my "Save" dialogs on the data stacks but then just  
> proceeds to quit anyway without waiting for the user to respond.
>
> On the Mac it works perfectly in response to a Quit by properly  
> asking if the stacks that need saving should be saved. It cycles  
> through them and closes each stack and then quits the standalone.
>
> On Windows it properly asks if the stacks that need saving should be  
> saved. However, after it cycles through them and closes each stack,  
> it leaves the standalone open. If I then Quit or close (click on X)  
> the standalone it quits correctly.
>
> Here is the front script:
>
> on shutdownRequest
>  put the openStacks into vOpenStacks
>  filter vOpenStacks with "*.ifw" -- checks to make sure it is a data  
> stack
>  if the number of lines in vOpenStacks > 0 then
>    repeat for each line tLine in vOpenStacks
>      close stack tLine
>    end repeat
>  end if
>  pass shutdownRequest
> end shutdownRequest
>
> Any idea why the Windows standalone doesn't quit when finished like  
> the Mac does?
>
> Bill Vlahos
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list