Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!oliveb!felix!john From: john@felix.UUCP (John Gilbert) Newsgroups: comp.sys.mac.hypercard Subject: Re: HyperTalk Card-Linking Message-ID: <21694@felix.UUCP> Date: 16 Feb 88 23:21:16 GMT References: <3856@islenet.UUCP> Sender: daemon@felix.UUCP Reply-To: john@felix.UUCP (John Gilbert) Distribution: na Organization: FileNet Corp., Costa Mesa, CA Lines: 83 In article <3856@islenet.UUCP> ric@islenet.UUCP (Frederick Lee) writes: >I'm trying to link a "mastercard" with its detail/memo card using hypertalk, >for each new mastercard created. Manually creating a hard link is straight- >forward and I wish to emulate that using HyperTalk. > >The end result should be a detailed button that the user clicks to get to >the particular detailed card. > >I've tried popping the card ID into a variable and going to that card via >"go card thisCard". But this HyperCard gives the "...unable to locate.." >alert. > >P.S. A new Detailed Card is created for each new Master Card. Well, there are several way to address a card from HyperTalk, and being the "friendly" language that it is, the syntax is not real rigid... You can say (among other more explicit things)... go card 3 This example goes to the third card in the stack, relative to the sorted order of the cards. Changing the order of the cards will change the result. Apparently the fastest way to go to a card, all other things being equal. go card id 3 This will always go to the same card as long as cards are not deleted (and maybe even if they are ... not sure). The card ID is assigned when the card is created, and remains constant. Finding the card is a bit slower this way. go card "foo" If you name your cards, and the names are unique, then this is generally the most reliable way (I think). About the same as using 'card id 3', maybe a bit slower. Something interesting to note, you will have problems if you want to name your cards with numbers. The command ' go card "3" ', will go to card NUMBER 3, not a card with the name "3". Now the interesting thing about HyperCard is that the way you used it: >"go card thisCard". But this HyperCard gives the "...unable to locate.." ... it all depends on what you have in 'thisCard'. If it contains "card id 3", than this is different than "3", and you would want to say go theCard. The following script, tho maybe unnecessary, should work for any legitimate card identifier: on mouseUp put field "detail card" into thisCard if word 1 of thisCard is "card" then go thisCard -- handles long card IDs else go card thisCard -- handles card names, numbers if the result is not empty then go card id thisCard -- handles short card IDs end if end if if the result is not empty then answer "Somebody goofed somewhere!" -- particularly helpful error message end if end mouseUp This assumes you have the identifier stored in a background field called "detail card". You can do this, or, if the you really want, the button in question could be a card button with a specialized script of it's own. But, this is a different topic. If you intend to use card ID's, then you may be having trouble if you have "card id 3" in thisCard, and you are saying "go card thisCard". This needs to be "go thisCard". If thisCard contains "3", then you need to explicitly differentiate between a card ID and a card NUMBER with either: "go card id thisCard", or "go card thisCard" respectively. John Gilbert -- John Gilbert !trwrb!felix!john