Where to store text lists?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 37
- Joined: Mon Nov 16, 2020 8:16 pm
Where to store text lists?
Good evening from Germany,
my name is Frank and I am quite new to LiveCode.
I would like to build an application in which I have to read text from some comma separated text lists to fill some array variables which are used in an educational game.
The reason for this is that I need text lists that can be edited without the need of the LiveCode engine with a simple text editor.
Now I wonder where to put and store these text lists in LiveCode. For testing purposes I created some text fields and put the text items into them.
Of course the user should not see these lists so I made them invisible for the user. This works but I am not sure if this is the best practise way to achieve what I want.
Is there a special place (a special card in stack or some place else) where objects should be stored which the user should not see or interact with?
Sorry for my bad English, I hope I could explain to you what I want to know.
Thanks in advance for your help.
LG F.
my name is Frank and I am quite new to LiveCode.
I would like to build an application in which I have to read text from some comma separated text lists to fill some array variables which are used in an educational game.
The reason for this is that I need text lists that can be edited without the need of the LiveCode engine with a simple text editor.
Now I wonder where to put and store these text lists in LiveCode. For testing purposes I created some text fields and put the text items into them.
Of course the user should not see these lists so I made them invisible for the user. This works but I am not sure if this is the best practise way to achieve what I want.
Is there a special place (a special card in stack or some place else) where objects should be stored which the user should not see or interact with?
Sorry for my bad English, I hope I could explain to you what I want to know.
Thanks in advance for your help.
LG F.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Where to store text lists?
AS far as I am aware the only way you can STORE text docements IN a LiveCode standaloneto put and store these text lists in LiveCode
would be in a macOS standalone as it is a disguised folder full of components.
-
- VIP Livecode Opensource Backer
- Posts: 4003
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Where to store text lists?
Welcome to the forum Frank.
As far as I understand you want to store text in Livecode that the user can not access.
If the text is prepared before building the standalone and does not change later on then storing the text in a hidden field is perfectly alright.
If you want to store text between runs of a standalone you would have to save it out to an accessible folder. For example "Documents". See specialFolderPath in the dictionary.
The standalone can not write text to its app folder but it can read from text added to the standalone at compile time. Here again it would probably be the easiest way to store the text in a hidden field or a field in a sub stack and not to bother storing text at build time in the app bundle.
Kind regards
Bernd
As far as I understand you want to store text in Livecode that the user can not access.
If the text is prepared before building the standalone and does not change later on then storing the text in a hidden field is perfectly alright.
If you want to store text between runs of a standalone you would have to save it out to an accessible folder. For example "Documents". See specialFolderPath in the dictionary.
The standalone can not write text to its app folder but it can read from text added to the standalone at compile time. Here again it would probably be the easiest way to store the text in a hidden field or a field in a sub stack and not to bother storing text at build time in the app bundle.
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Where to store text lists?
Hi.
There is another way to save data between sessions apart from an external file that Bernd suggested, and that is in a stack file attached to the executable file. That way everything stays as stacks within LC. This is called the "splash stack" method and is often a matter of personal style, sometimes depending on the size or format of the data.
Otherwise, I agree with Bernd to keep it simple. In a standalone, even an experienced LC developer would have a hard time exposing a hidden field.
Craig
There is another way to save data between sessions apart from an external file that Bernd suggested, and that is in a stack file attached to the executable file. That way everything stays as stacks within LC. This is called the "splash stack" method and is often a matter of personal style, sometimes depending on the size or format of the data.
Otherwise, I agree with Bernd to keep it simple. In a standalone, even an experienced LC developer would have a hard time exposing a hidden field.
Craig
-
- Posts: 37
- Joined: Mon Nov 16, 2020 8:16 pm
Re: Where to store text lists?
Thank you very much for your help
Bernd, you are right. I only need to store these texts within the application. They cannot be accessed or changed by the user.
I used to work with Macromedia/Adobe Director in the past and remember that there were so called "casts" in which all objects were stored in a neat data grid where hundreds of objects could be seen at a glance. I wondered if there is something like that in LiveCode.
Since I need only 10 or 15 of these text fields this time I will store them as suggested on a card in the stack that the user cannot access.
Thanks again for the support
LG Frank
Bernd, you are right. I only need to store these texts within the application. They cannot be accessed or changed by the user.
I used to work with Macromedia/Adobe Director in the past and remember that there were so called "casts" in which all objects were stored in a neat data grid where hundreds of objects could be seen at a glance. I wondered if there is something like that in LiveCode.
Since I need only 10 or 15 of these text fields this time I will store them as suggested on a card in the stack that the user cannot access.
Thanks again for the support
LG Frank
Re: Where to store text lists?
Buongiorno Francesco,
there is also a german LC Forum, with quite low traffic, but in german.
https://www.livecode-blog.de/forums/for ... ode-forum/
You can also use "custom properties" to store your data INSIDE of your stack.
But some (hidden) fields will surely fit your needs, too.
Best
Klaus
there is also a german LC Forum, with quite low traffic, but in german.
https://www.livecode-blog.de/forums/for ... ode-forum/
You can also use "custom properties" to store your data INSIDE of your stack.
But some (hidden) fields will surely fit your needs, too.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Where to store text lists?
Another way is to store the text in custom properties. This is usually my preferred method. If you want a nice single compilation of text, store the text in an array and set a custom property value to the array. This is far faster than field access and doesn't require any additional stacks or controls.
If you need help learning about custom properties, we're here.
Edit : I just saw Klaus's answer. We think alike.
If you need help learning about custom properties, we're here.
Edit : I just saw Klaus's answer. We think alike.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Where to store text lists?
Custom properties won't work on the mobile main stack though will it? Changing the custom prop would modify the signed stack wouldn't it?
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Where to store text lists?
You could use a separate stack file for storage. But if all you're storing is an array, maybe just save the array to disk. See arrayEncode and arrayDecode for serializing into a form suitable for transfer and storage.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Where to store text lists?
I thought the OP is storing static data at build time. Maybe I misunderstood this:
If the data is dynamic then it can still be stored in a custom property at runtime, but it can't be saved. On the other hand, if it's dynamic, it probably doesn't need to be saved.I only need to store these texts within the application. They cannot be accessed or changed by the user.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com