Page 1 of 1

Does a card script get copied when you make a new card?

Posted: Mon Feb 15, 2010 12:56 am
by planix
Hi,

I am developing a small card based data management tool. Each card is the same and I am using grouped backgrounds to keep the data entry fields and buttons the same across cards. But, I also have a script in the card which sets a global variable to keep track of which is the current card (this is accessed from another stack to grab info from the current card to produce a report).

My problem is that when I copy a card the card script from the original card is not in the copied card. I am using "create card" in order to get a card with all the fields emptied. Is this what should happen? Or does create not copy the card level script over? This is what I suspect is the problem. If so, is there a simple workaround?

cheers

Alistair

Re: Does a card script get copied when you make a new card?

Posted: Mon Feb 15, 2010 1:04 am
by BvG
create will make a new card. Although all background groups that are on the current cards will be placed on the new card, it's still a new card, and not a copy. So you want to copy or clone the card, instead of creating a new one.

try the copy command, or the clone command, instead of the create command.

Re: Does a card script get copied when you make a new card?

Posted: Mon Feb 15, 2010 1:53 am
by planix
Hi,

Thanks. I have tried these and both copy over the data in the fields. I have set the Share Text propert of the relevant fields to false and this still happens. So maybe this only works with the create command?

I did find a work around. It's probably better programming rather than a workaround. I put an OpenCard command in the stack script and wrote a script to put the name of the current card into the global variable. This works exactly the way that I want it to.

cheers

Alistair