Where to store text lists?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Francesco77
Posts: 24
Joined: Mon Nov 16, 2020 8:16 pm

Where to store text lists?

Post by Francesco77 » Mon Nov 16, 2020 8:34 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5242
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Where to store text lists?

Post by richmond62 » Mon Nov 16, 2020 8:56 pm

to put and store these text lists in LiveCode
AS far as I am aware the only way you can STORE text docements IN a LiveCode standalone
would be in a macOS standalone as it is a disguised folder full of components.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3458
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Where to store text lists?

Post by bn » Mon Nov 16, 2020 10:34 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7289
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Where to store text lists?

Post by dunbarx » Mon Nov 16, 2020 10:59 pm

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

Francesco77
Posts: 24
Joined: Mon Nov 16, 2020 8:16 pm

Re: Where to store text lists?

Post by Francesco77 » Tue Nov 17, 2020 9:29 am

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

Klaus
Posts: 12117
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Where to store text lists?

Post by Klaus » Tue Nov 17, 2020 3:29 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5770
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Where to store text lists?

Post by jacque » Tue Nov 17, 2020 6:53 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

kdjanz
Posts: 242
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Where to store text lists?

Post by kdjanz » Tue Nov 17, 2020 11:12 pm

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?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8278
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Where to store text lists?

Post by FourthWorld » Tue Nov 17, 2020 11:55 pm

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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5770
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Where to store text lists?

Post by jacque » Wed Nov 18, 2020 12:47 am

kdjanz wrote:
Tue Nov 17, 2020 11:12 pm
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?
I thought the OP is storing static data at build time. Maybe I misunderstood this:
I only need to store these texts within the application. They cannot be accessed or changed by the user.
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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”