[comp.sys.mac.hypercard] disabling 'Quit'

73747.1257@compuserve.com (02/27/90)

I'm no HyperCard wizard, but it strikes me that something like disabling
the 'Quit' menu item would be a pretty strange and difficult thing to do.
If anyone has addressed the problem, let me know, or a friend of mine
(who's the one typing this posting) will have to try and figure out how
to write some nasty deceptive XCMD for me. Save him from this torture
and send me the solution to my problem!

Reply via mail and my friend will summarize to the net. And no cracks
about how I should post this on CompuServe. I can't afford it. [Ed. Note:
And those CompuServe bozo's aren't as good as you nice, considerate,
UseNetters anyway.]

Wayne Lemieux, making a special appearance from 73747.1257@compuserve.com.

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (02/27/90)

In article <4097@hub.UUCP> 73747.1257@compuserve.com writes:
>I'm no HyperCard wizard, but it strikes me that something like disabling
>the 'Quit' menu item would be a pretty strange and difficult thing to do.

Nope.

  on doMenu theItem
    if theItem is "Quit HyperCard" and the optionKey is up then
      beep
      answer "You cannot quit from this stack!" with "Moo-ha-ha"
    else
      pass doMenu      -- DO NOT FORGET THIS LINE!!!
    end if
  end doMenu

The above disallows the selection of Quit (unless you're holding down the
option key).

>And those CompuServe bozo's aren't as good as you nice, considerate,
>UseNetters anyway.]

*ahem* I resemble that remark....
-- 
====== 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

bskendig@phoenix.Princeton.EDU (Brian Kendig) (02/28/90)

In article <4097@hub.UUCP> 73747.1257@compuserve.com writes:
>I'm no HyperCard wizard, but it strikes me that something like disabling
>the 'Quit' menu item would be a pretty strange and difficult thing to do.
>If anyone has addressed the problem, let me know, or a friend of mine
>(who's the one typing this posting) will have to try and figure out how
>to write some nasty deceptive XCMD for me. Save him from this torture
>and send me the solution to my problem!

I screwed up in my original solution to this.  Here's a more correct
answer:

	on doMenu theMenuItem
	  if theMenuItem is not "Quit HyperCard" then pass doMenu
	end doMenu

This should do the trick nicely.

     << Brian >>

-- 
| Brian S. Kendig      \ Macintosh |   Engineering,   | bskendig             |
| Computer Engineering |\ Thought  |  USS Enterprise  | @phoenix.Princeton.EDU
| Princeton University |_\ Police  | -= NCC-1701-D =- | @PUCC.BITNET         |
|   Systems Engineering, NASA Space Station Freedom / General Electric WP3   |

tim@hoptoad.uucp (Tim Maroney) (02/28/90)

In article <4097@hub.UUCP> 73747.1257@compuserve.com writes:
>I'm no HyperCard wizard, but it strikes me that something like disabling
>the 'Quit' menu item would be a pretty strange and difficult thing to do.
>If anyone has addressed the problem, let me know, or a friend of mine
>(who's the one typing this posting) will have to try and figure out how
>to write some nasty deceptive XCMD for me. Save him from this torture
>and send me the solution to my problem!

-- in stack script, background script, card script, or home script

on doMenu cmd
  if cmd is "Quit HyperCard" then
    play "Boing"
    answer "You're stuck here, me bucko!" with "Oh no!"
    exit doMenu
  end if
  pass doMenu
end doMenu

In my opinion, most stacks should have scripts like this to intercept
such menu commands as Next, Prev, Top, Home, and Help, and at the least
perform the appropriate graphics.  Generally the best way to do this is
with code like:

  if cmd is "Next" then
    send mouseUp to bkgnd button "Next"
    exit doMenu
  end if

And so on for other commands that move between cards and stacks.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Gorbachev is returning to the heritage of the great Lenin" - Ronald Reagan