Stand Alone application doesn't save changes made in the Dat

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
galina
Posts: 14
Joined: Sun Dec 14, 2014 6:16 pm

Stand Alone application doesn't save changes made in the Dat

Post by galina » Tue Nov 17, 2015 12:27 pm

Hi,
sorry, if I post my question not in exact section: I found it very complicated to search in the forums here; and, it seems, I have a limited permission for posting.

I made a very simple app for a desktop, where one DataGrid contains the search list, which can be modified. When I do changes of this list in LiveCode IDE, it perfectly saved after I close the app, and I see all changes after I open it again (in LiveCode).

When I do same in the Stand Alone application, all changes which I make, disappear when I open the app the next time.

For adding a new record I use
dispatch "AddData" to group "DataGrid 1" with tArray, theNewLine

For deleting I use
DeleteIndex theIndex

I edit existing record just directly in the cell after double click.

In Stand Alone settings I've included Ask Dialog, Answer Dialog and Script Library: Table. There is no choice for DataGrid Script Library.

When I close the stack, I save it with command "save stack...".

What I can do that the Stand Alone would work as it works in LiveCode IDE?
Thanks!
Galina

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Stand Alone application doesn't save changes made in the

Post by dave.kilroy » Tue Nov 17, 2015 7:26 pm

Hi Galina

The bad news is that you can't save changes to a standalone - so your app that saves changes beautifully in the IDE won't be able to save changes to itself once it's a standalone

The good news is that there are ways in which you can allow users so save data on their system - such that it appears they are saving data to the standalone

The two main ways of doing this are:

One - saving data to an external source (text file, database etc) as the user makes changes and when they relaunch the app have code inside your app that re-loads the user-changed data from that external source

Two - making a standalone nothing but a 'launcher' that immediately opens a Livecode stackfile (your main app), that because it is not a standalone, is able to have changes and data saved to it.

Some people like the first way and others prefer the second. There are lots of tutorials and examples on how to save data in your standalones using both of the above methods - just use the search box in the forum or Google it :)

Kind regards

Dave

PS: I myself prefer the first way where you save data externally...
"...this is not the code you are looking for..."

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Stand Alone application doesn't save changes made in the

Post by Simon » Tue Nov 17, 2015 9:34 pm

Here is the splash method;
http://lessons.livecode.com/m/4071/l/17 ... pplication

I think LiveCode should have a big sign "Standalones cannot be modified" as this is one of the most often asked questions. And Galina, this is not just a liveCode thing, no app can do this... Well maybe viruses.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

galina
Posts: 14
Joined: Sun Dec 14, 2014 6:16 pm

Re: Stand Alone application doesn't save changes made in the

Post by galina » Wed Nov 18, 2015 3:54 am

Thank you very much, Simon!
Everything is very clear, and, yes, I understand the reason why apps don't store input within...
I was thinking about using an external file for this particular app. For more serious application I would use a DB.

"Launcher" means that a user has to have installed LiveCode IDE on his desktop? I am not experienced in LiveCode yet, but giving to a user access to LiveCode IDE, looks for me even more dangerous than a virus in input? :) Unless I do not see the whole picture here.

I agree with you about the big sign on Standalne description, it would save a lot of time for many people. :)

Thanks again,
with best wishes,
Galina

SparkOut
Posts: 2834
Joined: Sun Sep 23, 2007 4:58 pm

Re: Stand Alone application doesn't save changes made in the

Post by SparkOut » Wed Nov 18, 2015 8:22 am

"Launcher" does not mean IDE. It is the standalone file you create which calls your "working" file, often referred to as the splashstack method. It's the idea in the link Simon provided above. Essentially you do all your development in the IDE and when happy with your "working" file, you then create a new, separate stack file which is saved as a standalone - this is the launcher. In the standalone settings for the launcher you use the copy files tab to include the working file when the standalone is created. The code within the launcher is only to launch the working file, or additionally if necessary (for example on mobile) to copy the working file to a writeable location on first run of the app.

Note: the tutorial in the given link says to manually copy the working file to the same place as the launcher standalone after it's built. That will only work on desktop, and not very convenient to distribute apps. Use the copy files tab of the standalone builder to bundle them together. Look up specialFolderPath("resources ") for info about where things go.

galina
Posts: 14
Joined: Sun Dec 14, 2014 6:16 pm

Re: Stand Alone application doesn't save changes made in the

Post by galina » Wed Nov 18, 2015 1:38 pm

Ok, thanks a lot for explanation.
It seems, I did as you said and as the tutorial explains. I have bundled the launcher and the working files, as you've suggested. The launcher does open the working file, but... the DataGrid doesn't work any more: no scrolling, no editing, nothing...
Definitely, I do something wrong!!!

Galina

SparkOut
Posts: 2834
Joined: Sun Sep 23, 2007 4:58 pm

Re: Stand Alone application doesn't save changes made in the

Post by SparkOut » Wed Nov 18, 2015 3:23 pm

OK for datagrids there is another piece of magic required, see here: http://lessons.livecode.com/m/datagrid/ ... -data-grid

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Stand Alone application doesn't save changes made in the

Post by dave.kilroy » Wed Nov 18, 2015 3:33 pm

galina before you go too far down the 'splash stack' route could you describe the scenario of how you will be deploying your app, how you will be updating the app (i.e. bringing out new versions), and how you wish user-data to be managed?

Both approaches have their merits and demerits and it might be worthwhile making sure you are choose the best option for your circumstances

Dave
"...this is not the code you are looking for..."

galina
Posts: 14
Joined: Sun Dec 14, 2014 6:16 pm

Re: Stand Alone application doesn't save changes made in the

Post by galina » Thu Nov 19, 2015 3:36 pm

Thanks to both of you, Dave and SparkOut!!!
"Splash stack" now works. External file also works very well. There is no complete clear picture for me yet about Stand Alone, I need to read much more information, to get more experiences. Generally, it's a studying process for me.

Thank you guys, I believe, it's not the last question I ask here :)

Best wishes,
Galina

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Stand Alone application doesn't save changes made in the

Post by dave.kilroy » Thu Nov 19, 2015 4:08 pm

Very welcome Galina - we all come to the 'well' to learn - sometimes by helping others with their questions, sometimes by asking our own questions :)
"...this is not the code you are looking for..."

Post Reply

Return to “App Building Course”