sort stack by short id of this card

Scott Rossi scott at tactilemedia.com
Mon Feb 25 06:25:01 EST 2002


Recently, Stgecft at aol.com wrote:

>> I have a stack I am scripting for work.  For years I have been using this in
>> Hypercard.  It is a "Form" made of six cards (designed to print cards 1 &2 on
>> one page, cards 3 & 4 on the next page and cards 5 &6, on the last page). I
>> have rewriten it in transcript and am now setting it to copy itself, and sort
>> so that I have each form in order by field "Order Number".  (on mouseUp....go
>> first .... repeat 6..new card....go next........sort stack by short id of
>> this card)
>> 
>> Everything works fine....untill I got to Card ID 10000. Now card id 10000 has
>> decided it wants to be first in the card order.

> There are 6 cards for each (1) form.  The 6 cards have the same "Index
> Number". In order to keep all of the cards in order they are being sortd by
> shot id of card....  When I get to id 10000
> (this card is card #3 in the cequence) the cards start to get out of
> sequence.  Consiter that the first thing that happends is "go first". this
> means that card #3 is being copied fired and recieving the first id.  From
> there on the cards are copied and sorted in the wrong order.


Relying on the short ID numbers seems pretty limiting.  Is there any reason
you can't create your own numbering system and use that to sort the cards?

For example, establish a user property for each card, like "uSortNumber":

   set the uSortNumber of this cd to XXXXXX

Each time you duplicate your cards, the user property will be duplicated
with each card, so you'll have to update the numbers (properties).

Then sort your stack's cards by this property:

   sort cards of this stack by the uSortNumber of this cd

Regards,

Scott Rossi
Creative Director

Tactile Media, Multimedia & Design
Email: scott at tactilemedia.com
Web: www.tactilemedia.com




More information about the Use-livecode mailing list