Saving Field Text in a Standalone

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Saving Field Text in a Standalone

Post by trailboss » 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.
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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Saving Field Text in a Standalone

Post by bogs » Tue Mar 02, 2021 11:02 pm

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
Image

kdjanz
Posts: 300
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Saving Field Text in a Standalone

Post by kdjanz » Tue Mar 02, 2021 11:34 pm

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.

trailboss
Posts: 121
Joined: Sat Dec 13, 2008 4:55 pm

Re: Saving Field Text in a Standalone

Post by trailboss » Tue Mar 02, 2021 11:45 pm

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...

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Saving Field Text in a Standalone

Post by bogs » Tue Mar 02, 2021 11:58 pm

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..... :twisted:
Image

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”