Page 1 of 1

Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 7:16 pm
by physicsclassroom
I'm finishing a standalone application that has several stacks in it. There is one final bug in the program. Th bug does not surface when I test in the IDE but when I test both the Windows and Mac builds, the bug surfaces. I am trying to close the splash stack (opening stack) when I navigate to other stacks. I'm using the commands:

Code: Select all

set the destroyStack of stack (appLocn & "teacherStart.livecode") to true
close stack (appLocn & "teacherStart.livecode")
where appLocn is set to specialFolderPath("Resources") & "/". All other commands referencing files at appLocn work so that doesn't seem to the the problem. In both the Windows and Mac, builds these two lines issue an error and the teacherStart stack remains open. I've also tried to use

Code: Select all

set the visible of stack (appLocn & "teacherStart.livecode") to false
but this results in an error as well and the stack remains visible. The above two lines seem like such a simple set of commands that work everywhere I use them but not when I use them with the splash stack.

What am I missing?

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 7:45 pm
by FourthWorld
What's in appLocn?

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 8:03 pm
by physicsclassroom
It is a global variable that is set to the location of the build. For Mac it has been set to specialFolderPath("Resources") & "/".

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 8:09 pm
by richmond62
Let's start all over again . . .

IFF I were to make something with a splash stack I'd make sure the splash stack were a substack of my mainStack . . . let's call our splash stack "SPLASH" (for want of any spontaneous, mad bursts of original static).

If my main stack were called "MAINST" (Yes, well quite, I could repeat 'that' again), I'd probably have something of this sort in its stackScript of "MAINST":

Code: Select all

on preOpenStack
set the vis of stack "MAINST" to false
set the lockScreen to false
open stack SPLASH"
set the loc of stack "SPLASH" to the screenLoc
wait 10 ticks
set the lockScreen to true
end preOpenStack
and I'd have something like this in the stackScript of the substack "SPLASH":

Code: Select all

on openStack
wait 30 secs
set the vis of stack "MAINST" to true
set the vis of stack "SPLASH" to false
end openStack
Now, this may be utter rubbish as I made it up just now without testing anything fuelled by 3 glasses of
best, dry Bulgarian white wine.

Live dangerously . . . try it!

The splash stack is NOT closed, it is just HIDDEN. 8)

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 8:38 pm
by richmond62
Splosh.jpg
-
MAINST.livecode.zip
Here's the stack.
(100.04 KiB) Downloaded 140 times
-
Wow: for almost the first time in my life a stack worked without lots of fiddling around.

I changed the wait period to 10 seconds as 30 was too long.

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 9:15 pm
by FourthWorld
physicsclassroom wrote:
Sun Aug 12, 2018 8:03 pm
It is a global variable that is set to the location of the build. For Mac it has been set to specialFolderPath("Resources") & "/".
Is that where the stack is?

Try adding:

Code: Select all

put (appLocn & "teacherStart.livecode") into tStackFile
answer "Exists?: "& there is a stack tStackFile &cr& tStackFile
That'll at least rule out path issues, the most common cause of inaccessible files (the second leading cause is file permissions).

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 9:35 pm
by physicsclassroom
The result was True in the IDE and false in the stand alone. So it's a path problem.

In my preOpenStack handler, I have ...

Code: Select all

put specialFolderPath("Resources") & "/" into appLocn
and then I reference all files in my stand alone with

Code: Select all

someCommand (appLocn & "nameOfStack.livecode")
In the stand-alone, there is no main stack at this location but there is for all the other stacks in the build.

Puzzled.

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 10:23 pm
by physicsclassroom
My main stack has the file name "teachStart.livecode". I tried to locate it in the stand-alone with

Code: Select all

specialFolderPath("Resources") & "/" & "teachStart.livecode"
and as

Code: Select all

specialFolderPath("Engine") & "/" & "teachStart.livecode"
No luck with either. How can I located the main stack in order to close it or make it invisible?

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 10:46 pm
by FourthWorld
Is this the mainstack of the standalone?

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 11:05 pm
by physicsclassroom
yes it is.

Re: Can't Close Splash Stack on Stand Alone

Posted: Sun Aug 12, 2018 11:35 pm
by FourthWorld
Then we have a problem, and an opportunity:

The problem is that document file extensions like ".livecode" are just that, to identify documents. When a LiveCode stack file is made into a standalone, the document extension is removed, thus making hard-wired paths that rely on it from when it was a document file invalid.

The solution is easy: every stack in memory can be addressed by its short name. Just use that. Skip the file reference altogether.

Re: Can't Close Splash Stack on Stand Alone

Posted: Mon Aug 13, 2018 1:17 am
by physicsclassroom
Problem solved. The stack is now closing in the stand alone.

Thanks so much for your patience and help.