How to add a field to a stack of 50 cards

Phil Davis davis.phil at comcast.net
Sat Nov 15 22:12:15 EST 2003


1) Create the field on the first card of the stack. In this example, I named
it "cardNumber". (See item 6 below.)

2) Group the field, and give the group a name (e.g. "cardNum"). Technically
not required, but it makes the process a little less cumbersome.

3) Set the group's backgroundBehavior to true. This will assure it is
automatically placed on any cards that get created in the future.

4) You could set the field's sharedText property to false. But this doesn't
really matter, since the script in item (6) below refreshes the fld contents
every time a card opens.

5) Create a temporary button on card 1 with this script. The script adds the
group (with its field) to each card:
     on mouseUp
       lock screen
       repeat with x = 2 to the number of cards
         go card x
         place group "cardNum" onto this card
       end repeat
       go cd 1
       unlock screen
     end mouseUp


6) In the stack script, add a preOpenCard handler:
     on preOpenCard
       put (the number of this card) into fld "cardNumber"
     end preOpenCard
This will assure that you're always seeing the correct card number on each
card, even if you delete some, add some, or move some around.

I love recipes.

HTH -
Phil Davis


> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Russell
> Sent: Saturday, November 15, 2003 6:29 PM
> To: use-revolution at lists.runrev.com
> Subject: How to add a field to a stack of 50 cards
>
>
>
> Hi people
>
> I was playing around and after creating several cards decided to
> create a field to hold the card number.  Then thought about the
> problem that if you wanted to add this field to say 50 cards in
> your stack do you have to add it to all 50 or is there some
> background slight of code that can do it?
>
> Thanks
>
> Russell
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list