Page 1 of 1
need advice - solved
Posted: Tue Jun 12, 2012 6:40 pm
by Christo777
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
Re: need advice
Posted: Tue Jun 12, 2012 8:11 pm
by FourthWorld
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.
Re: need advice - part 2
Posted: Thu Jun 21, 2012 2:45 am
by Christo777
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.
Re: need advice
Posted: Thu Jun 21, 2012 3:02 pm
by Mark
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