Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!batcomputer!pyramid!voder!apple!winkler
From: winkler@apple.UUCP
Newsgroups: comp.sys.mac.hypercard
Subject: Re: YAHCB (Yet Another HyperCard Bug)
Message-ID: <6923@apple.UUCP>
Date: Mon, 7-Dec-87 14:57:13 EST
Article-I.D.: apple.6923
Posted: Mon Dec  7 14:57:13 1987
Date-Received: Sat, 12-Dec-87 18:25:31 EST
References: <60taylorj@byuvax.bitnet>
Reply-To: winkler@apple.UUCP (Dan Winkler)
Organization: Apple Computer Inc., Cupertino, USA
Lines: 46

To quote a cliche: "That's a feature, not a bug."  Here's why:

The button script said:

  on mouseDown
    -- doesn't matter what goes here, but it happened to be
    get script of this card
  end mouseDown

The card script said:

  on mouseUp
    beep 2
  end mouseUp

The user observed that clicking on the button caused the card script to
execute and concluded that the "get script..." line must have executed
the card script after getting it.  In fact, what happened was that
clicking the button sent two messages to the button.  The first was
mouseDown and the second was mouseUp.  The mouseDown was caught and
handled by the button.  The mouseUp passed through the button because
there was no handler for it there and was caught and handled by the
card.  That's why changing the button script to contain a mouseUp
handler rather than a mouseDown handler suppresses the beeps -- the
button then catches the mouseUp and it does not pass on the card.

If you want the card to respond only to mouseUp's sent directly
to the card rather than also to ones that inherit down to it from a
button, you can make its first line read:

  if "button" is in the target then exit mouseUp

If you want the card the receive mouseUp's even after the button has
handled them, you can make the last line of the button script read:

  pass mouseUp

This inheritance mechanism is perhaps HyperTalk's most powerful and
carefully designed feature and it is very natural and easy to use once
you understand it.  Have a look at the help stack and Danny Goodman's
tome for more information about inheritance.  For the whole story,
including the role of XCMDs and XFCNs and the difference between
static and dynamic inheritance paths, see the diagram included with
the APDA docs.  

Dan.