Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!pt.cs.cmu.edu!andrew.cmu.edu!jk3t+ From: jk3t+@andrew.cmu.edu (Jonathan King) Newsgroups: comp.sys.mac.hypercard Subject: Re: Intercepting deleteCard message Message-ID: Date: 18 Jul 90 00:48:53 GMT References: <6057@bgsuvax.UUCP> Organization: Psychology, Carnegie Mellon, Pittsburgh, PA Lines: 72 In-Reply-To: <6057@bgsuvax.UUCP> instone@bgsuvax.UUCP (Keith Instone) writes: > I can keep the user from sorting my stack with this simple little > handler: > > on sort > end sort This works because you have redefined the sort *command* to do nothing, and the command does not pass further up the hierarchy to hypercard, which would cheerfully shuffle your stack if it received it. > but this doesn't work for the deleteCard message (that is, the empty handler > doesn't keep the card from getting deleted). And that's because deleteCard is not a command, but a message that gets sent to a card just before it disappears. In effect, Hypercard has *already* pulled the trigger, but the victim gets the chance to have a few last requests... > I tried adding the 'exit to Hypercard' command (among other things), > but that didn't work either. Nope, this doesn't forestall the death sentence either. > Saving the card information and doing a 'new card' after the deletion > won't work very well because I am using card id's a lot. (Which is one reason I use card names a lot, but, hey, I use card names to hold up to 31 characters worth of neat card properties; too bad that user-definable properties of objects aren't yet a feature.) > All I REALLY want to do is ask "Are you sure you want to delete this card?" > and abort if the user says NO. But this you *can* do, even though the direct approach you tried doesn't work. The trick is to intercept the command to delete the card before it pulls the trigger. Note that you don't have to assume that the user would be deleting the card by using the menu item, since the only way to delete cards (in HC 1.2) is to to go through the "domenu" command. So if you had a button that deleted a card, you would just send 'domenu "Delete Card"' to the appropriate card. Then in that card's script you would put something like: on doMenu menuChoice if menuChoice is "Delete Card" then answer "Are you sure?" with "Delete" or "Cancel" if it is not "Delete" then exit doMenu end if pass do Menu --THIS IS A KEY LINE OR YOU'LL BE LOCKED OUT end doMenu That's it! This is essentially identical to the script on p. 86 of the apparently-soon-to-be-obsolete Hypercard Script Language Guide published by Addison Wesley. > Any suggestions? Hope this will work for you. > Keith instone@andy.bgsu.edu > Thanks in advance, HyperTalk-style: > put "Advance" into adv > put "Thanks" after char 3 of adv > put adv Or you could just replace adv with the omnipresnet it... jking [But seriously: is there going to be a new official Hypertalk Script Language Guide (HSLanG) for HC 2.0? If there is, will it appear pretty soon or next summer?]