creating a new card with proprety of an other card

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Eldriden
Posts: 4
Joined: Wed Apr 04, 2012 12:03 pm

creating a new card with proprety of an other card

Post by Eldriden » Wed Apr 04, 2012 12:43 pm

Hello everyone,
i'm having a problem. Well, i have a button wich create a new card. But i don't know how in the same time it create buttons from an other card on the new card. I don't want to add them manually ! It's when i click on the button that those things are created. I also want to add a field with text in it on the new card.

Can someone help me please?
thanks :)

ps : my english isn't perfect yet :s.

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

Re: creating a new card with proprety of an other card

Post by Klaus » Wed Apr 04, 2012 1:08 pm

Hi Elridem

welcome to the forum! :D

You said "buttons from another card...", so you could just COPY these buttons to the new card?
...
copy btn "name of button here" of cd "the other card" to cd "the newly created card"
...

Or you can "create button" etc. check "create" in the dictionary!
Do also check "the templateXYZ", which comes very hand in these cases.


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: creating a new card with proprety of an other card

Post by dunbarx » Wed Apr 04, 2012 1:14 pm

Are you wanting to duplicate cards or just add objects from one card to another? Klaus has addressed the second option.

For the first, check out the "clone" command in the dictionary.

You must also examine the ability to group objects, and set the "backGroundBehavior" of that group to "true". Then whenever you create a new card, that group will be duplicated as well. The entire set of objects on a card can be handled in this way, creating a common stack of cards all with the same objects.

Fields within that group can contain either the same text or text unique to the card they reside on. This is another property that is set at your command.

Craig Newman

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

Re: creating a new card with proprety of an other card

Post by Klaus » Wed Apr 04, 2012 1:23 pm

Hi Eldriden,

make sure to work through these stack:
http://www.runrev.com/developers/lesson ... nferences/

Great learning resource!


Best

Klaus

Eldriden
Posts: 4
Joined: Wed Apr 04, 2012 12:03 pm

Re: creating a new card with proprety of an other card

Post by Eldriden » Wed Apr 04, 2012 1:58 pm

thanks a lot klauss and dumbarx. It's really what i wanted

Eldriden
Posts: 4
Joined: Wed Apr 04, 2012 12:03 pm

Re: creating a new card with proprety of an other card

Post by Eldriden » Mon Apr 09, 2012 1:10 pm

hi once again,
I have an other problem. I searched everywhere but i didn't find any ressource about it.
When i click on a button, it create a button on an other stack.
No problem for that.
But i want that that button has a new script (for example go to card x).

Can someone help me?

Thanks,

Eldriden

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

Re: creating a new card with proprety of an other card

Post by Klaus » Mon Apr 09, 2012 1:34 pm

Hi Eldriden,

you can set the scipt of that new button via scipt, but there are limits in doing so, please check "scriptLimits" in the dictionary!

Basically you would do something like this, which will work for very short scripts like "go cd XYZ":
...
put "on mouseup" & CR & "go cd 2" & CR & "end mouseup" into tScript
## create your button here...
set the script of btn "the newly created button" of cd X of stack Y to tScript
...

Best

Klaus

Eldriden
Posts: 4
Joined: Wed Apr 04, 2012 12:03 pm

Re: creating a new card with proprety of an other card

Post by Eldriden » Mon Apr 09, 2012 2:00 pm

thanks Klaus ;)

It's simply perfect :D

Post Reply