Copy Stack?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Copy Stack?

Post by lohill »

Is there a way to copy a substack from one main stack to another main stack? If there is a way I would much prefer that to building the whole thing over again,

Thanks,
Larry
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy Stack?

Post by Klaus »

Hi Larry,

not directly, but possible :D

Do something like this:
...
## Make a copy of the stack
## CLONE will automatically make a substack a mainstack and add "Copy of " to the name
## The substack does not need to be open!
clone stack "Name of substack" of stack "Mainstack"

## Set its mainstack
set the mainstack of stack "Copy of Name of substack" to "New mainstack"

## Now rename that stack if neccessary
set the name of stack "Copy of Name of substack" of "New mainstack" to "Name of substack"

## If neccessary:
close stack "Name of substack"
...
Tested and works 8)


Best

Klaus
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Copy Stack?

Post by lohill »

Thanks Klaus,

I'll give it a try.

Larry
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy Stack?

Post by Klaus »

Just tested and works! :D
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Copy Stack?

Post by lohill »

Klaus,

Worked like a champ.

I did have to change:
set the name of stack "Copy of Name of substack" of "New mainstack" to "Name of substack"

to:
set the name of stack "Copy of Name of substack" of stack "New mainstack" to "Name of substack"

Thanks again for such a quick reply.
Larry
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Copy Stack?

Post by Klaus »

Ah, yes, sorry, "made in a hurry" :D
Post Reply