tbodine wrote:
I'm building a desktop app as a standalone that will use separate stacks to
store the user's work. A "New File" button creates the stack under a new
name and saves it to the user's document area. When the user closes such a
file, it looks like it still persists in memory. (Going by what the
Application Browser shows.) What's the best way to remove these document
stacks from memory in a standalone?

The simplest way is to set the stack's destroyStack property to true, which doesn't actually destroy the stack itself but merely removes it from memory when it's closed.


Also, the app will need to save user's preferences. Knowing that main stacks
cannot save to themselves, I set it up with a substack that stores prefs in
custom properties. However, I see now that the substack is actually part of
the main stack file. So doesn't that means the substack will have the same
problem of being sandboxed by the OS and unable to save? What solutions do
you recommend?

Data can be saved to mainstacks, provided it's not the stackfile which is the executable. In fact, one can't even save to substacks of the mainstack of the stackfile which is the executable, but as long as its a separate file you're good.

Exactly where you should save stackfiles used for prefs data is an item of much contention these days; some say that Apple's HIG recommendation to use the Preferences folder no longer applies unless you use their APIs to read and write it, opting instead to store prefs in an entirely different folder, Application Support.

While there's been much discussion of which is best here, I don't think anyone's yet provided a URL to Apple's guidelines on this, though it would be helpful if someone can turn it up.

I suppose it's not unthinkable that Apple would attempt to control the file format devs use for prefs, but it seems a bit draconian even for Apple, and I suspect that with so many devs accustomed to being able to control their own file formats there'd be more of an outcry if indeed this is what Apple is now requiring.

So I'll leave it for others here to suggest where to put it (I still put prefs in Preferences, but so far I've been avoiding the App Store so I don't know if those reviewers are requiring preferences to be stored outside of Preferences), but as far as the basic mechanics of saving data in a standalone this article from Sarah is very helpful:

<http://livecodejournal.com/tutorials/saving_data_in_revolution.html>

--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to