need advice - solved

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
Christo777
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 13
Joined: Thu Nov 16, 2006 4:34 am

need advice - solved

Post by Christo777 » Tue Jun 12, 2012 6:40 pm

Hello,

I am creating an App and I want the user not to lose his work on quitting. He should have a choice to start anew or continue with his work when he comes back. It can contain objects like fields, buttons and graphics that the user can manipulate and move. Can a standalone create and reuse stack documents? Should I rather save the user stacks in a modified format so that they wont start LiveCode intead of my App when double-clicked ?

thank you
Last edited by Christo777 on Fri Jun 29, 2012 2:12 am, edited 1 time in total.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10051
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: need advice

Post by FourthWorld » Tue Jun 12, 2012 8:11 pm

Stackfiles have a filename property, which can be set to any path (such as 'specialFolderPath("preferences")' ) and then subsequent save commands will save the file to that location.

Stacks can also be cloned using the 'clone' command.

Between those two you should be able to come up with all sorts of nifty ways to save data locally for restoring in a future session.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Christo777
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 13
Joined: Thu Nov 16, 2006 4:34 am

Re: need advice - part 2

Post by Christo777 » Thu Jun 21, 2012 2:45 am

Thank you. I did just that and it works.

Now I still have this problem :
I have an open stack whose name is nameofmystack and whose filepath is pathtomystack

in a script, I try to close this stack and open another one (which is in a different file) but with the same name (nameofmystack).

I always have that warning saying there is already an open stack with the same name (nameofmystack) even if I use the commands :

set the destroystack of stack nameofmystack to true
close stack nameofmystack

I even tried the same commands with pathtomystack.

These instructions are not in the stack I want to close (which would explain why memory is not released before I try to open the other stackfile).

One solution I can try is: save the stack, rename the stack, close it without saving. Then open the other one.

But that doesn't explain the behavior.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: need advice

Post by Mark » Thu Jun 21, 2012 3:02 pm

Hi,

When you close a stack, the window is closed, but the stack may still be in memory.This happens if the destroyStack property of the stack is false. There are two ways to fix this.

The first way is to set the destroyStack property of the stack to true. As soon as you close the stack, it will also be deleted from memory.

The second method is to delete instead of close the stack. Use the "delete" command to delete a stack. The stack will be deleted from memory, not from your hard disk.

Of course, both methods don't work with substacks. If you close a substack whose destroyStack property is true, it will still stay in memory as long as its mainstack is in memory. If you delete a substack, it will be actually deleted from the stackfile in memory and it will also disappear from disk when you save the stackfile. You wouldn't want that.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply