HyperCard: Don‘t Refer to Cards by ID in Non-Static Stacks



I'm working on a HyperCard application that makes extensive use of card ID
numbers while also doing a lot of copying/cutting and pasting of cards for
various reasons. The problem is that ID numbers occasionally change after
cards are cut and/or pasted. As a result, functions that rely on the old ID
numbers are upset.

Is there a way around this? When are card ID numbers changed; when are they
not? Is there a way to force the ID number to remain the same or to change the
ID number of an existing card?

My current solution is to check the ID number before and after copying, and if
changed, laboriously replace all instances of the old ID number string with the
new in all scripts (unsatisfactory, but better than nothing). In particular, I
am working with two separate stacks, copying cards from one stack and placing
them in another with the hope that the ID number will be the same on the new
stack. There doesn't seem to be a pattern to when the ID number changes and
when it doesn't.

Referring to cards by their ID number is a great idea in static stacks. ID
numbers are guaranteed to be unique, so the user can be sure no conflicts
result. When working in a constantly changing stack, it's best to
reference the card by name. When a card is created, we suggest that the
user use something like:

set the name of this card to "C" & the ID of this card

to name the card. That way, names are reasonably unique (conflicts will be
extremely rare) and cutting and pasting won't change the item referenced.
The letter in quotes (in this case "C") can be any character, although it's
safer to use letters. The purpose of the leading letter is to keep
HyperCard from referencing card NUMBER "xxx" instead of card NAME "xxx".


Published Date: Feb 18, 2012