Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: disabling command-q Message-ID: <37051@apple.Apple.COM> Date: 6 Dec 89 23:33:46 GMT References: Organization: Apple Computer Inc, Cupertino, CA Lines: 35 In article jk4i+@andrew.cmu.edu (John McCall Kingsley, III) writes: >I am trying to figure out a way that I can diable the user from using >command-q and closing the stack, in my application the user must quit >using one of my quit buttons, otherwise the databases get messed up, so >is there anyway to trap the command-q and return to the card that you >were on at the time of the command-q To disable the Quit HyperCard menu item and its command-key equivalent, you need to trap the doMenu message (which is sent when the user selects Quit or presses command-Q) as follows: on doMenu theItem if theItem is "Quit HyperCard" then beep answer "Click one of the Quit buttons to quit." else pass doMenu -- DO NOT UNDER ANY CIRCUMSTANCES FORGET THIS LINE! end if end doMenu Note: If the quit buttons use the doMenu command to get out of the stack, the above handler will trap the message and prevent it from being executed. To prevent this, instead of doMenu "Quit HyperCard" in the button script, use send "doMenu" && quote & "Quit HyperCard" & quote to HyperCard This will bypass the doMenu handler. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST