Quitting a standalone and saving open stacks

Bill Vlahos bvlahos at mac.com
Sun Apr 20 14:18:01 EDT 2008


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


More information about the use-livecode mailing list