copy to mainstack substack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
copy to mainstack substack
Hi
Here's another question about stacks manipulation.
Is it possible to copy or clone a mainstack to become the substack of a second mainstack.
In all my tests the copy is always a mainstack.
Pascal
Here's another question about stacks manipulation.
Is it possible to copy or clone a mainstack to become the substack of a second mainstack.
In all my tests the copy is always a mainstack.
Pascal
Re: copy to mainstack substack
As I wrote in another posting, make your stack a substack with script!
Every "cloned" (and copy/pasted) stack is first a MAINSTACK:
...
clone stack "my stack"
set the mainstack of stack "copy of my stack" to "the other mainstack..."
...
Every "cloned" (and copy/pasted) stack is first a MAINSTACK:
...
clone stack "my stack"
set the mainstack of stack "copy of my stack" to "the other mainstack..."
...
Re: copy to mainstack substack
Hi Klaus
Ok it works. I did not understand everything at the first explanation.
But I do not understand why it should be noted "the mainstack of stack".
Why not just stack (because at the moment there is no substack)
With a code that starts with "go to" for example, it's not necessary to specify "Mainstack of" to be recognized as a stack. Only his name is required (right?)
So what is the reason for this distinction? (I hope not to be too curious).
Pascal
Ok it works. I did not understand everything at the first explanation.
But I do not understand why it should be noted "the mainstack of stack".
Why not just stack (because at the moment there is no substack)
With a code that starts with "go to" for example, it's not necessary to specify "Mainstack of" to be recognized as a stack. Only his name is required (right?)
So what is the reason for this distinction? (I hope not to be too curious).
Pascal
Re: copy to mainstack substack
Well, that's the ONLY way to make stack "A" a substack of stack "B":
...
set the MAINSTACK of stack "A" to "B"
...
And it is the only command in Livecode where you use the term "MAINSTACK"
...
set the MAINSTACK of stack "A" to "B"
...
And it is the only command in Livecode where you use the term "MAINSTACK"

Re: copy to mainstack substack
Well I'll try to remember.
Thank you very much.
Pascal
Thank you very much.

Pascal
Re: copy to mainstack substack
A file on disk can have several stacks in it, but there can only be one primary stack. All the others must be substacks. The primary stack is called the mainstack, and when you set a stack's "mainstack" property, you are telling the engine to attach the stack to the same file on disk as the main stack, which causes it to become a substack.pascalh4 wrote:But I do not understand why it should be noted "the mainstack of stack".
Why not just stack (because at the moment there is no substack)
When referring to a stack in a script, you don't need to specify whether it is a mainstack or not, but when you want to change the relationship of a stack to another one, you can set its mainstack property.
You can also use "mainstack" to find out which stack is the owner of a substack: "put the mainstack of this stack" gives the name of the substack's owner (the primary stack in the file.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com