Saving standalone substacks

J. Landman Gay jacque at
Wed Dec 16 13:20:02 EST 2009

James Hurley wrote:

> Actually, I had recalled that the splash screen was the way to go.
> My question is really quite primitive. When the user quits, or just 
> wants to save the substacks, what is the action plan, specifically, what 
> is the code? Save.....the substacks name. Is a file path required? Like 
> I said, my question is quite primitive.

Depends on what your stack does. If you've changed the defaultfolder, 
then you'll need to calculate a file path back to your satellite stacks 
(I don't like the word "substacks" in this case because those are stacks 
embedded in the mainstack, and they can't save data. Separate stacks 
opened by a splash app need a different name.) The default location when 
your splash starts up is the same folder as the splash app is in. You 
can handle this several ways:

1. Reset the defaultfolder to the one where your splash exists, if 
you've changed it. Refer to satellite stacks by their relative path.

2. Calculate file paths to the satellite stacks and use those as stack 

3. Set the stackfiles property of your splash so that it points to 
relative path locations for the satellite stacks. Then you can just 
refer to them by their short names and Rev can still find them. This is 
perhaps the easiest way to manage it.

However you determine the stack paths, the rest is the same. Loop 
through the names of your satellite stacks when the user requests to 
quit, and save each one. You can ask the user if they want to save each 
of them, if that fits your app better.

Assuming three stacks in the same folder as your standalone, with the 
defaultfolder set to that directory:

on shutdownRequest
   repeat for each item i in "stack1.rev,stack2.rev,stack3.rev"
     save stack i
     close stack i
   end repeat
   pass shutdownRequest
end shutdownRequest

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the Use-livecode mailing list