Page 1 of 2

LC makes my stack a substack

Posted: Tue Mar 26, 2024 1:05 pm
by oldummy
This problem harkens back to the problem I encountered earlier that still exists, but if someone here can help me I believe if someone here can explain this to me, it will fix my original issue.
I have two stacks residing in the same folder. One is destined to be the application stack. It is simply a means to navigate to the second stack.The second is destined NOT to be a substack.
When I open the first stack, it is it's own mainstack as it should be. When I navigate to the second stack, the inspector says it is a substack of the first stack.
If I click "make Mainstack" it does change to be it's own mainstack.Ok.
Now when I try to save the second stack, windows asks me if I want to replace that stack. Click yes,save and exit.
Now I cannot navigate to the second stack from the first stack.
Instead, I get this error from LC:
Handler: error in statement
Field
go stack "Jukebox2"
mouseup
I have uninstalled and reinstalled LC twice while battling this.

Re: LC makes my stack a substack

Posted: Tue Mar 26, 2024 1:43 pm
by richmond62
OK, OK: probably I am being a bit stupid as usual, so please could you explain HOW you open the second stack from the first stack?
-
Screenshot 2024-03-26 at 14.39.46.png
-
As THAT does something very odd indeed:
-
Screenshot 2024-03-26 at 14.42.12.png
Screenshot 2024-03-26 at 14.42.12.png (71.01 KiB) Viewed 1058 times
-
I have NO idea what that stack "revCo..." is. 8)

This, on the other hand works perfectly, with no nonsense about stack "Stack TWO" being a substack of anything:
-
Screenshot 2024-03-26 at 14.44.36.png

Re: LC makes my stack a substack

Posted: Tue Mar 26, 2024 2:56 pm
by dunbarx
Hi.

So you want two stacks, the first being your "splash" stack and the second being your "working" stack (or stacks).

Make sure that each resides in its own separate stack file. Each must live that way. If they are currently not, change them.

Craig

Re: LC makes my stack a substack

Posted: Tue Mar 26, 2024 4:11 pm
by jacque
There is no syntax error in the reported statement. Can we see the whole handler that opens the second stack?

It may be that LC is looking for the stack in the defaultfolder, which is normally LC's application folder. But in that case I'd expect a "can't find stack" error.

Re: LC makes my stack a substack

Posted: Wed Mar 27, 2024 11:40 am
by oldummy
It is a simple mouseup handle.

Code: Select all

on mouseup 
go stack "jukebox"
end mouseup

Re: LC makes my stack a substack

Posted: Wed Mar 27, 2024 2:32 pm
by dunbarx
@oldDummy.

What is different, apart from the name, between:

Code: Select all

go stack "Jukebox"
and:

Code: Select all

go stack "Jukebox2"
??

Craig

Re: LC makes my stack a substack

Posted: Wed Mar 27, 2024 6:44 pm
by jacque
When you made the substack into a mainstack, did you also save the original mainstack? If not, then the substack may still be there. I believe LC moves the substack out to a new mainstack and deletes the one embedded in the first mainstack, but if you don't save it the substack will remain.

Try this:
Check that you have a stack "Jukebox.livecode" in the same folder.
Use the project browser to confirm the substack still exists in the first mainstack. If so, delete it.
Save the mainstack.
Close and remove it from memory [in the File menu]
Reopen the mainstack.
Change the field handler to: go stack "Jukebox.livecode"
Try the handler again.

If that still doesn't work then LC is probably looking in the wrong folder. Add an openStack handler in the main splash stack:

Code: Select all

on openStack
  set the defaultfolder to specialFolderPath("resources")
end openStack
Save the mainstack,, close and remove from memory, and then reopen it and try the handler again.

Re: LC makes my stack a substack

Posted: Thu Mar 28, 2024 2:01 pm
by oldummy
The jukebox and jukebox 2 issue was just me experimenting with saving the stack as a different name and then exchanging it with the existing stack with a change in the go stack script.
That did not work either.
I believe I've tried adding the .livecode to the name but I will try it to make sure.
Thanks folks.

Re: LC makes my stack a substack

Posted: Thu Mar 28, 2024 2:12 pm
by richmond62
Just to be awkward, and return to the original posting:

Why can't one of the stacks be a substack of the other one?

Re: LC makes my stack a substack

Posted: Thu Mar 28, 2024 4:54 pm
by dunbarx
Richmond.

Unless any stacks apart from the executable stack are in separate stack files, they won't save changes. Substacks don't cut it.

Craig

Re: LC makes my stack a substack

Posted: Thu Mar 28, 2024 5:53 pm
by richmond62
Mind you, you can save data to, say, a text file.

Re: LC makes my stack a substack

Posted: Thu Mar 28, 2024 10:50 pm
by dunbarx
Mind you, you can save data to, say, a text file.
Yep, that is the "other" way to do it, likely a favorite for many. I like the splash method.

Craig

Re: LC makes my stack a substack

Posted: Sat Mar 30, 2024 5:01 pm
by oldummy
I am going to trash it all as I feel somehow I have corrupted it. My intention now is simple to remake them both and copy every script and object to make another pair of stacks and try the build again.
Thank you all for your suggestions!

Re: LC makes my stack a substack

Posted: Sat Mar 30, 2024 6:13 pm
by jacque
I suspect the problem isn't corruption, but if the new stacks fail in the same way then I'd be happy to take a look at them and see if I can find the problem. Or send them now if you want to avoid reproducing everything.

Re: LC makes my stack a substack

Posted: Sun Mar 31, 2024 3:20 pm
by dunbarx
oldDummy.

I agree with Jacque, it is not a corruption thing. Somehow it is a problem with LC "finding" the other stack. Currently, are you certain that your mainStack and your "other" stack are both mainStacks, and each live their own stack files? And this would not matter until you create a standalone.

But in the IDE, it should not matter. You might try re-creating that second stack from scratch with a new name, and see if you can navigate to it.

Craig