Hi Larry,
I asked you why you saved substacks as separate files. That is not exactly the same as recommending to not use separate files. If you are using separate files already, while working on your project, your standalone will probably work fine with separate files. If you are using substacks, you probably don't want to save them as separate files.
You now have two options. The first option is to use the splash window approach and tell the standalone builder to save substacks as separate files. If you choose this, you need to make sure that all stack files are loaded by the splash window. I would expect that the standalone builder took care of this, but apparently it doesn't always do so. You need syntax similar to
Code: Select all
// load separate stack files
set the itemDel to slash
put item 1 to -2 of the effective filename of this stack into myPath
go inv stack (myPath & "/Name of Stack File.rev"
This will load the stack "Name of Stack File.rev" into memory. From then on, you can refer to it by it's short name, for example "Name of Stack File" (without extension).
Your second option is to save the data of the datagrid to a file. Simply write the data to a file when you close the application and read the data from that file when you start the application. Make sure to keep this file in a writable location, e.g. the documents folder.
Oops, there might be a third option. The third option is to not use separate stack files, except for one stack file, which includes the main stack and all substacks. I think this is what Dave means. If your stack is called "Portfolio Manager.rev" then your splash window needs to include the following script:
Code: Select all
on preOpenStack
hide me
put the effective filename of me into myPath
set the itemDel to slash
put item 1 to -2 of myPath into myPath
go stack (myPath & "/Portfolio Manager.rev") in new window
-- remainder of script here
end preOpenStack
This script would load your single separate stack file with all it's substacks into memory. After you build the splash standalone, you copy your substack into the same folder as the executable. On Windows, this is just the .exe file. On the Mac, you need to open the application package and search for the folder "/Contents/MacOS", which contains a Unix executable with the name of your standalone. Put your substack into this folder.
One remaining problem is that the standalone often resides in a locked applications folder. This means that you still can't save changes in your substack. Therefore you need to copy this substack to a writable location, such as the documents folder, when your application starts for the first time. If you do this, the script in the splash stack would look as follows (on Mac OS X):
Code: Select all
on preOpenStack
hide me
put the effective filename of me into myPath
set the itemDel to slash
put item 1 to -2 of myPath into myPath
if not (there is a file "~/documents/Portfolio Manager.rev") then
revCopyFile (myPath & "/Portfolio Manager.rev"),"~/documents/Portfolio Manager.rev"
end if
go stack "~/documents/Portfolio Manager.rev" in new window
-- remainder of script here
end preOpenStack
I hope this helps.
Best,
Mark