Page 1 of 1

Using more than one stack

Posted: Sun Jun 04, 2023 3:35 am
by JoyceNub
I used the script from my main stack to open another stack, and then close it. How do I get the rest of the script to go back to using the main stack?

Re: Using more than one stack

Posted: Sun Jun 04, 2023 3:55 am
by JoyceNub
I think I figured it out! I just had to open the original stack.

Re: Using more than one stack

Posted: Sun Jun 04, 2023 3:58 am
by dunbarx
Hi.

Welcome to the forum.

When you go to another stack and then close that stack in the same handler, you will automatically find yourself back in the original stack. Something like:

Code: Select all

on mouseUp
go stack "yourOtherStack"
close stack "yourOtherStack
end mouseup
So where do you end up when you do that?

Craig

Re: Using more than one stack

Posted: Sun Jun 04, 2023 4:03 am
by dunbarx
Hi again,

It just occurred to me, do you navigate to other stacks in your sojourns? if so, you will end up in the last stack you visited.

True?

If so, just explicitly navigate to where you want to end up:

Code: Select all

on mouseUp
  go stack "otherStack1"
  wait 20 --just to see what is going on
  go stack "otherStack2'
  wait 20 --just to see what is going on
  close stack "otherStack1"
  wait 20 --just to see what is going on
  go stack "yourStartingStack" --back to the starting stack
end moueUp
Craig

Re: Using more than one stack

Posted: Sun Jun 04, 2023 8:31 am
by richmond62
What I wonder is why you would not have ALL the stacks you need set up as substacks of a master stack;
it would certainly prove simpler.

Re: Using more than one stack

Posted: Sun Jun 04, 2023 1:12 pm
by stam
The common scenario where this will be needed is a splash stack - a stack which is loaded at startup and which will become the actual standalone app that then launches the mainstack (which remains a modifiable, normal LC stack) and closes itself.
I'd agree with Richmond that for almost everything else, substacks (for UI or code) and scriptOnlyStacks (for code, but which can also generate UI) are usually a better fit.

Re: Using more than one stack

Posted: Sun Jun 04, 2023 4:31 pm
by dunbarx
I may have simply missed what everyone seems to think is obvious, but there was no mention of a standalone.

@Joyce. Standalone? If so, substacks and a splash stack for sure.

Craig