Page 1 of 1
Creating a new card and clone a group into it
Posted: Sun Jul 21, 2013 5:16 pm
by momo
Hi
I want to make a button that creates a new card and clones/copies all element in a certain group onto the card.
I tried something like:
create card
clone group groupname
but it created like 400+ new cards.
any suggestions how it might work?
Re: Creating a new card and clone a group into it
Posted: Sun Jul 21, 2013 5:44 pm
by Klaus
Hi Momo,
1. maybe you just want to PLACE the group on any new card, instead of cloning/copying?
2. If you really want to COPY the group do this:
...
create card
copy grp "name of grpoup you want ot copy here..." OF CD "name of card where the original group exists" to this cd
## Since "create card" also GOES to that new card, we can use "...onto THIS card"!
...
Best
Klaus
Re: Creating a new card and clone a group into it
Posted: Mon Jul 22, 2013 11:25 am
by momo
Hi
I tried the code you posted but ran into a problem
When i use: create card it creates 600+ new cards and only stops because the recursion limit is reached.
code on the button:
on mouseUp
create card
end mouseUp
regards
momo
Re: Creating a new card and clone a group into it
Posted: Mon Jul 22, 2013 12:03 pm
by Klaus
Hi Momo,
well "create card" will create 1 (one) card, unless you tell Livecode to do more than this!
So it looks like there is something else going on on your side!?
Any other scripts involved?
"opencard" maybe in stack script?
Maybe in the group your are cloning/copying?
Where did you put that script to "create card"?
Best
Klaus
Re: Creating a new card and clone a group into it
Posted: Mon Jul 22, 2013 12:16 pm
by momo
Hi Klaus
I still dont know the problem but when i deleted the button + code and made a new one with the same propeties it worked
I quess somehow it got looped and was calling itself over and over again.
regards
Momo
Re: Creating a new card and clone a group into it
Posted: Mon Jul 22, 2013 12:25 pm
by Klaus
A little Livecode hiccup, shit happens
OK, but the question remains:
Do you really need a copy of that group on every new card,
or can you "place" the same group on every new card?