Page 2 of 5
Re: save content of field
Posted: Mon Nov 29, 2021 12:52 pm
by Samuele
dunbarx wrote: Fri Nov 26, 2021 6:07 pm
Do you see? You will be building with a package of two stacks instead of one. The problem is that with a one-stack build, that stack becomes the executable, which cannot be saved in any OS. But adding another stack to that build allows saving to that stack.
Craig
aha! ok thanks, that's what i couldn't understand, so when i want to save the highscore for example, what do i do? i save it also in the splash stack (for example on a label), and then write "save stack "splash" ?
thanks
and another question, does the splash stack adds a lot to the size of the app?
Re: save content of field
Posted: Mon Nov 29, 2021 3:39 pm
by dunbarx
Getting there...
You cannot save the splash stack. It lives ONLY as a vehicle for OTHER stacks. Those are where you do all your work and where you can save. Those are the stack files that you add to the splash stack in the Standalone Application Settings of the "File" menu of the "Stacks"" pane.
The splash stack opens when the standalone opens. That is all it does. Now in the card script of the splash stack, put a handler like this:
Code: Select all
on openCard
go stack "myWorkingStack"
hide stack "mySplashStack"
end openCard
So the splash stack opens, navigates to your other stack or stacks, and hides itself. The other stacks have to have handlers that save all your work, perhaps on a closeStack message, or anywhere and anytime you like. But again, all your work is done in those other stacks.
Practice a little. Make a splash stack and another stack that does some simple thing. Make a standalone. Work it until it, er, works.
As for your other question, a splash stack (and your other stacks) add almost nothing to the size of the build. Almost all of that is due to carrying the LC engine, which is most of the application size.
Craig
Re: save content of field
Posted: Mon Nov 29, 2021 10:30 pm
by Samuele
hi, thanks, i've tried but it doesn't work, i wrote this on the stack script
Code: Select all
on openStack
go stack "Working"
hide stack "Splash"
end openStack
on the computer it works and it goes right away to the "working" stack but on mobile it doesn't go and it remains into the "splash" stack...
Re: save content of field
Posted: Mon Nov 29, 2021 10:33 pm
by Samuele
can i share the stacks? (if yes, how?)
thanks!
Re: save content of field
Posted: Tue Nov 30, 2021 8:48 am
by SparkOut
I think it was mentioned before, but the app folder mapped to "resources" is not writeable. On first run, you need to check whether the stack that needs to be saved exists already in the app "documents" folder and if not, copy it there from "resources".
You should refer to the path to the data stack using the writeable location.
Re: save content of field
Posted: Tue Nov 30, 2021 2:38 pm
by dunbarx
@Sparkout.
It seems as if the mobile version is not navigating to the working stack, not that there is still a saving problem.
@Samuele. Is this in fact the case?
Craig
Re: save content of field
Posted: Tue Nov 30, 2021 2:40 pm
by dunbarx
@Samuele
can i share the stacks? (if yes, how?)
thanks!
Just attach the stacks to a post here. That is done down at the "Attachments" tab just below the text field.
Craig
Re: save content of field
Posted: Tue Nov 30, 2021 4:05 pm
by Klaus
You need to ZIP it first!
Re: save content of field
Posted: Wed Dec 01, 2021 4:25 pm
by Samuele
these are the two stacks, it's supposed to go to the stack Working and it does it on the computer but not on mobile (if you can standalone it and see for yourself it would be great)
thanks
dunbarx wrote: Tue Nov 30, 2021 2:38 pm
It seems as if the mobile version is not navigating to the working stack, not that there is still a saving problem.
@Samuele. Is this in fact the case?
Craig
yep

Re: save content of field
Posted: Wed Dec 01, 2021 4:47 pm
by Klaus
In the s"Standalone Application Settings" do NOT use "Stacks" to add your second stack "Working".
Click "Copy files..." and add that stack there.
You will find it in any standalone on any platform later here ->
specialfolderpath("resources")
Then you can open it with:
Code: Select all
...
put specialfolderpath("resources") & "/Working.livecode" into tTargetStack
go stack tTargetStack
hide stack "Splash"
...
If you want to save that stack at some point, please re-read SparkOut posting again!
Re: save content of field
Posted: Wed Dec 01, 2021 5:21 pm
by Samuele
Klaus wrote: Wed Dec 01, 2021 4:47 pm
If you want to save that stack at some point, please re-read SparkOut posting again!
Code: Select all
global _gUserName
on mouseDown
put the text of widget "fi" into _gUserName
put _gUserName into field "la"
if the environment is "mobile" then
mobileVibrate 3
--save this stack
put specialfolderpath("resources") & "/Working.livecode" into tStackToSave
save stack tStackToSave
end if
end mouseDown
i don't know if it's this you meant but like this it doesn't save the app and when i close it there's nothing in the field
ideas?
thanks!
Re: save content of field
Posted: Wed Dec 01, 2021 5:28 pm
by Klaus
You did not read SpakOut's posting, right?
Here the important parts:
I think it was mentioned before, but the app folder mapped to "resources" is not writeable.
So your script cannot work.
On first run, you need to check whether the stack that needs to be saved exists already in the app "documents" folder and if not, copy it there from "resources".
What does this tell you?
Re: save content of field
Posted: Wed Dec 01, 2021 5:48 pm
by dunbarx
Klaus
Click "Copy files..." and add that stack there.
I thought that pane was for external files that were NOT stack files, and that stack files were always added in the "Stacks" pane. Thinking about it now, since both are files, not stacks that are being added, I am not sure of the difference.
Is this something particular to mobile?
Craig
Re: save content of field
Posted: Wed Dec 01, 2021 5:59 pm
by Klaus
Since that stacks needs to be copied to the Docs folder, I thought "Copy files..." would be the right place.
Toi be honset, I have no idea where stack added by "Stacks" will end up in the standalone.

Re: save content of field
Posted: Wed Dec 01, 2021 7:59 pm
by dunbarx
Hmmm. I don't know either. Funny how I think I am fairly proficient working inside LC, but seem to be a complete newbie when working outside of LC. Outside meaning things like how to save a stack attached to a splash stack.
I never do; I always live and work in the IDE. The handful of engineers that I make stuff for seem to be able to save , but after talking to one of them, he is not sure how he does it. We do know that these guys use Windows, keep the entirety of the build in a nested "sharedDocs" folder that is not in any kind of "Documents" folder.
I understand that some folders are writable and some not. Does Windows also require an explicitly named "Documents" folder in order to save?
Craig