Page 1 of 1
Saving Field Text in a Standalone
Posted: Tue Mar 02, 2021 10:46 pm
by trailboss
I've looked around to find out about this and people say I must create a stack that is not a substack of the project because it won't be editable.
My problem is that I don't know how to create a stack that isn't a substack and thus a part of the un-editable standalone. I just need a little editable/savable data stack that my program can launch on start-up and put its info into a couple of fields.
For some reason I'm a little lost.
Thanks in advance,
Tom
Re: Saving Field Text in a Standalone
Posted: Tue Mar 02, 2021 11:02 pm
by bogs
trailboss wrote: ↑Tue Mar 02, 2021 10:46 pm
I've looked around to find out about this and people say I must create a stack that is not a substack of the project because it won't be editable.
Erm, well, kinda.
You save your project as a stack (it can have substacks, whatever). The way you get it to 'save' all it's parts is to create a launcher stack, separately from your project, that launches your project.
https://lessons.livecode.com/m/4071/l/1 ... pplication
Re: Saving Field Text in a Standalone
Posted: Tue Mar 02, 2021 11:34 pm
by kdjanz
Could you do this with a text data file instead of a stack? If you need to save binary data, can you put it into an array and encode it before saving to disk?
If you must save a preferences stack, all you need to do is open a new stack (call it Prefs). Add a field or some other object to hold the info you want save. Then save this new stack to the user’s documents folder or preferences folder, depending on the device and OS that you are working on. You have to make sure to save it to a writeable location on the user’s device.
In your main stack, as part of your openStack script, you can look for that file & open it if it exists (or make a new stack and get your user to save some new prefs if it doesn’t exist). Whenever the user changes something in the Prefs stack, just save it back to disk or device and read in the new info on next startup. This way, your main stack never changes, but your prefs can change as much as required.
Hopefully this gets you on the right track.
Re: Saving Field Text in a Standalone
Posted: Tue Mar 02, 2021 11:45 pm
by trailboss
Oh, now I get it. It makes sense. The stacks I made before are just accessed through the launcher. They never become standalones. It's good because I have four programs that have the exact same set-up. The user can choose any of them from the splash screen on the launcher.
Thank you very much. I'm likely to have another quesion.
Until then...
Re: Saving Field Text in a Standalone
Posted: Tue Mar 02, 2021 11:58 pm
by bogs
Yep, I think you got it
trailboss wrote: ↑Tue Mar 02, 2021 11:45 pm
I'm likely to have another quesion.
Well, we don't charge by the answer.....
