Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mcnc!ecsvax!dlugose From: dlugose@ecsvax.UUCP (Dan Dlugose) Newsgroups: comp.sys.mac.hypercard Subject: Re: indexes in hypercard Message-ID: <7355@ecsvax.UUCP> Date: 19 Jul 89 17:34:55 GMT References: <514@extro.ucc.su.oz> Reply-To: dlugose@ecsvax.uncecs.edu.UUCP (Dan Dlugose) Organization: UNC Educational Computing Service Lines: 42 In article <514@extro.ucc.su.oz> awl@extro.ucc.su.oz (Tony Locke) writes: >Using the "link to" feature you can do a reasonable job >of linking related records together (in true "goto" fashion) but any >adding or deleting cards screws any indexing around. Anyone know >I can do this ? > >An example might be: > A --> Tony Able >If 'A' points to the first 'A' address, how do I write a button which allows >a user to add a card (e.g. "Steve Aaron") and resets the A pointer to look >this card, after the stack is sorted. I can think of 2 approaches: Create the index stack with 26 cards which can't be deleted, which will always be the first card for that letter. E.g. if there is a field "NameField" put "AAA" or "NNN" or whatever into that card. Therefore your pointers will never have to be updated. I also would hide these cards from sight with an opencard handler in them that set lockscreen to true go next set lockscreen to false Or maybe the set lockscreen to true should be done in the button? 2nd approach: Have the button go to the stack and search for the first "N" card. If this is a sequential search of cards, it's slow. 3rd approach: Set the first card of each letter's name to that letter, e.g. card "X" of stack Index. Also write a stack handler for: On domenu "delete card" If the short name of this card is not empty then -- update correct card go next if char 1 of field "personName" is "X" then set the name of this card to "X" else --if no other X cards decide whether link should go --to prev card or this card --etc Hope this is helpful Dan Dlugose UNC Educational Computing Service dlugose@uncecs.edu