Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!uw-june!moore From: moore@cs.washington.edu (Charles Moore) Newsgroups: comp.sys.mac.hypercard Subject: Re: Intercepting deleteCard message Summary: on doMenu Message-ID: <12568@june.cs.washington.edu> Date: 17 Jul 90 21:16:36 GMT References: <6057@bgsuvax.UUCP> Organization: U of Washington, Computer Science, Seattle Lines: 36 In article <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 > > but this doesn't work for the deleteCard message (that is, the empty handler > doesn't keep the card from getting deleted). > > All I REALLY want to do is ask "Are you sure you want to delete this card?" > and abort if the user says NO. The deleteCard message is NOT the message that causes HyperCard to delete the card. Rather, deleteCard gets sent to a card that is about to be deleted just prior to its deletion. This allows some handler to recognize that a deletion is about to occur and do something appropriate. The HyperCard Script Language Guide explains this and other purely informational system messages. What you want is: on doMenu theCommand if theCommand is "Delete Card" then answer "Are you sure you want to delete this card?" with "OK" and "Cancel" if it is "OK" then pass doMenu end if else pass doMenu end if end doMenu Note: The "else pass doMenu" part is VERY important. If you don't include it, you will suddenly discover that none of your menu commands work. Charles Moore