Hi Folks,
I'm trying to save text entered in a field of a stack using the suggested script from the preferences pane example:
on closeStack
save this stack
end closeStack
but when I reopen the stack the entered text has not saved.
Any ideas?
Thanks
Jim H
Save to a stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Dear Jim,
The closeStack handler runs after the stack has closed already. At that point, you can't save the stack anymore, since it is no longer there. If you use the closeStackRequest message instead of the closeStack message, you can solve this problem:
If you have any clean-up scripts, make sure they don't clean up your text field. Also, note that standalones cannot be saved.
Best,
Mark
The closeStack handler runs after the stack has closed already. At that point, you can't save the stack anymore, since it is no longer there. If you use the closeStackRequest message instead of the closeStack message, you can solve this problem:
Code: Select all
on closeStackRequest
save this stack
end closeStackRequest
Best,
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Save to a stack
Thanks Mark,
However, that doesn't seem to make a difference - in fact it seems to disable the close window button too!? When I close a project stack in revolution it asks me to save it anyway so I'm not quite sure what advantage the script has if it doesn't work in standalone mode?
Anyway, since I couldn't get it to work the simple way (as suggested in the documentation) instead I did it the other way by saving to a preferences.txt file. Shame it couldn't all be simply bundled together though.
Thanks again
Jim H
However, that doesn't seem to make a difference - in fact it seems to disable the close window button too!? When I close a project stack in revolution it asks me to save it anyway so I'm not quite sure what advantage the script has if it doesn't work in standalone mode?
Anyway, since I couldn't get it to work the simple way (as suggested in the documentation) instead I did it the other way by saving to a preferences.txt file. Shame it couldn't all be simply bundled together though.
Thanks again
Jim H
1. The posted script does not disable the close window button or any other button/element.
2. Rev always asks to save, no matter what you do. Therefore, that is not an indicator about whether your stack is actually saved or not.
3. Standalones cannot save themselves, but they can save stacks that are not part of the standalone file.
2. Rev always asks to save, no matter what you do. Therefore, that is not an indicator about whether your stack is actually saved or not.
3. Standalones cannot save themselves, but they can save stacks that are not part of the standalone file.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Hi Jim,
Sorry, I always write my handlers without much thinking in this forum, it seems ;-)
However, if you had looked up the closeStackRequest message in the built-in docs, you would have noticed that my script should have been
If you want to save data inside a stack, simply don't make it part of your standalone but keep it in the same folder as your standalone or give it a different file extension and save it in your documents folder.
Best,
Mark
Sorry, I always write my handlers without much thinking in this forum, it seems ;-)
However, if you had looked up the closeStackRequest message in the built-in docs, you would have noticed that my script should have been
Code: Select all
on closeStackRequest
save this stack
pass closeStackRequest
end closeStackRequest
Best,
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
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode