Multiple Stack Instances

Mike Bonner bonnmike at gmail.com
Tue Oct 9 11:08:04 EDT 2012


If the stack is a substack or a mainstack with no subs you can also skip
the step of having a middleman file.

copy stack "stackname"
set the mysavedstack of this stack to the clipboarddata["objects"]

To restore the stack..
set the clipboarddata["objects"] to the mysavedstack of this stack
paste

If the stack exists in memory already it'll show up as "copy of.." and you
can do as andrew said, just rename it.  After the paste "it" will contain
the name of the just pasted stack making it easy to name it whatever you
want.

On Tue, Oct 9, 2012 at 9:01 AM, Klaus on-rev <klaus at major.on-rev.com> wrote:

> Hi Andrew,
>
> Am 09.10.2012 um 16:50 schrieb Andrew Kluthe <andrew at ctech.me>:
>
> > This is kind of what I do already, Mark. I really want to allow them
> > to have several open forms that they can minimize and pull back up as
> > needed. There will probably only be about 4-5 maximum instances of
> > this at a time. But I want to code 1 stack and have many instantiate
> > copies of the stack. I can handle the data stores and all of that but
> > how do I actually turn 1 stack into 4-5 stacks with script? Do I just
> > 'copy stack "form" ' and if that is the ticket, how do I manage calls
> > to that stack if they all use the same stack name? I''ve never
> > constructed cards or stacks with scripts before.
>
> here is what I did in the past:
> 1. Create your "form" stack as a mainstack will all elements and scripts
> 2. Save it to disk
> 3. Read it into a custom property:
> ...
> set the cFormStack of this stack to url("binfile:" & pathtoyourmaistack)
> ...
> 4. open it and rename it immediately to avoid name conflicts like this:
> ...
> put the cFormStack of this stack into tStack
> go stack tStack
> set the short name of stack "your_template_form" to ("form" & the seconds)
> ## or whatever the name of the original stack was
> ...
>
> This way you can have some kind of template stack (not templatestack! ;-)
> create gazillions of instances from it and don't need to mess around with
> "clone" or whatever.
>
> Sounds strange, but works like a charm :-D
>
> > Thank you for the response,
> >
> > Andrew Kluthe
>
> Best
>
> Klaus
>
> --
> Klaus Major
> http://www.major-k.de
> klaus at major.on-rev.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list