Page 1 of 4
Having trouble building an app
Posted: Thu Dec 24, 2020 7:04 pm
by oldummy
I have made a stack with one substack. The main stack simply has a button to go to the other stack. All works fine, but when I build the application I wind up with two stacks and no application. I have made applications in the past and never had trouble with this. Has anything changed in the application builder in the last 3-4 years?
Re: Having trouble building an app
Posted: Thu Dec 24, 2020 7:49 pm
by richmond62
Could you tell us:
What computer operating system you are using?
What version of LiveCode you are using?
Re: Having trouble building an app
Posted: Thu Dec 24, 2020 10:17 pm
by dunbarx
Hi,
Does the build process do its thing, that is, a dialog or two show up with an indication of activity? Or does nothing happen all?
Craig
Re: Having trouble building an app
Posted: Fri Dec 25, 2020 3:23 am
by oldummy
I'm running livecode 9.6 on windows 10.
Also the application runs builder runs with all the dialogues I always had, and says it's successful. Creates the app folder with two stacks in it instead of the app file with the stack file in the folder 'DATA'
Re: Having trouble building an app
Posted: Fri Dec 25, 2020 11:27 am
by oldummy
With all of my thrashing about with this problem I have fooled myself into writing my previous post wrongly. My apologies. This I hope will clarify what is going on.
I uninstalled and reinstalled livecode 9.6.2.
My stack(a very simple one) is simply somewhere to record my blood glucose levels.
My mainstack is "Blood Sugar" and the substack is "Blood Sugar Record"
My stack script in the mainstack had only to do with positioning the substack and saving it, but I commented all of the stack script out.
In the card script of the main stack is the following:
on closeStackRequest
close this stack
end closeStackRequest
The only other script in the stack is the one button that takes me to the stack where my readings are recorded. It is simply:
on MouseUp
go stack "Blood Sugar Record"
end mouseUp
In the development environment all works as it is supposed to.
When I build the application,clicking the "Go to Record" button does nothing.
The substack is in the data folder as it should be, the application is where it is supposed to be.I can open the substack in the development mode and it works, but when I open the application and try to get to the substack, it does nothing.
I have looked for typos and extra spaces but can find nothing.
Re: Having trouble building an app
Posted: Fri Dec 25, 2020 11:46 am
by SparkOut
Merry Christmas
I don't know what the problem is for you but I wonder if the messages triggered during the standalone builder processes are having an effect, in some way connected to the issues noted here:
http://forums.livecode.com/viewtopic.ph ... 3&p=198447
Also, maybe just wondering, given your earlier posting, have you got a tick in the box in the standalone builder settings "Stacks" tab to "Move substacks into individual stackfiles"?
Re: Having trouble building an app
Posted: Fri Dec 25, 2020 5:21 pm
by jacque
A substack is a stack that is part of the same file on disk as the mainstack, not its own separate file. Since you mention it belongs in a Data folder it sounds like it isn't really a substack. How your app behaves will depend on where the stack is located.
If it isn't a substack, there could be different things happening when you close the mainstack. Can you verify whether the data stack is separate from the mainstack?
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 12:35 pm
by oldummy
Originally, there were two stacks, which is why I suppose I was getting two stacks at finish. Now the there is only one stack when I build. They are both shown in the "stacks" section. I do have "move substacks into individual stackfiles" selected as well as "create folder for stackfiles (data). Also I have "set destoystack to true" selected.
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 12:51 pm
by richmond62
I do have "move substacks into individual stackfiles" selected
THAT is where you are going wrong.
Your substacks must stay substacks.
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 1:04 pm
by oldummy
Yes, de-selecting that cured it. I am only just starting to do this again after years of being away. Thank you all. ANyone want to take a guess at that warning about the icon? Thanks again. Hopefully I can go back over my older stacks and remember more.
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 1:11 pm
by richmond62
ANyone want to take a guess at that warning about the icon?
Which warning would that be as you have only just mentioned it?
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 1:43 pm
by oldummy
Icon warning fixed by choosing use none
And while I thought I was out of the woods with this, the data in my substack will not save.
I have tried to save the data in the substack in so many scripts and have yet to have it save any changes. Here are all of the scripts:
Mainstack script:
on preOpenStack
set the rect of stack "Blood Sugar Record" to the rect of me
choose browse tool
end preOpenStack
on closeStack
save stack "Blood Sugar Record"
end closeStack
Substack script:
On moveStack
set the rect of stack "Blood Sugar" to the rect of this stack
end moveStack
on closeStack
save this stack
quit
end closeStack
Card script of subStack:
on openCard
set the locktext of fld "record" to true
end openCard
on closeStackRequest
save stack "Blood Sugar Record"
quit
end closeStackRequest
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 2:08 pm
by richmond62
Well, I too have never managed to save a substack inwith a standalone.
What I have done is saved data into a text file that can then be read back into a standalone when it is opened again.
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 3:12 pm
by oldummy
Ok. I do have a working application and substack that does indeed save the data. It's a diary dating back all the way to Hypercard 2.2. Changed it over with Runtime Revolution 4.0. But yes, the folder contains the application and the stack in a folder named "data" and I use it fairly often. I tried to open the data stack in livecode and livecode opens but no stack anywhere in the window. I tried to reinstall rev 4.0 with no luck.
So I suppose I am just out of date and will try to work around this somehow.
Re: Having trouble building an app
Posted: Sun Dec 27, 2020 6:32 pm
by jacque
Appps can't save data to themselves on any OS so your original method was correct. You need two stacks, the mainstack and the data stack. When you build a standalone, the mainstack contains all the LC code that runs everything, so when you close it, you are essentially quitting the app. That's why it wouldn't do anything when you clicked the button.
Rather than closing it, just hide it so the standalone can still run things. If you want the data stack to be in a folder, you need to separate the data stack from the mainstack and store it as its own file. Create a folder with the data stack inside it and drop the whole folder into the Copy Files pane of the standalone settings. Your app can access the file as specialFolderPath("resources") & "data/my stack.livecode".
Or alternately, set the stackfiles of the mainstack to recognize where the data stack is.