🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #19604

Re: HyperTalk mouseUp message

#19604
From: Paul Meyer
Date: Mon, 28 Sep 1987 18:22
67 lines
3246 bytes
In article <5236@jade.BERKELEY.EDU> 39clocks@violet.berkeley.edu  (Peter Marinac) writes:
>started by drawing a menubar below Apple's menubar, typed in a few menuNames,
>put invisible buttons over them and then created the dropdown portions of the
>menus with shadowed buttons. I created a script for the first menuName button
>that would show the buttons below it on a mouseDown and make them invisible
>on a mouseUp.  In the same script is a message handler for mousestilldown
>which keeps track of the vertical position of the cursor in such a way that
>the menuitems are hilited when the cursor passes over them.
...
> ...in fact, I cannot figure out what happens to the mouseUp message that
>is supposed to be sent when the mouse is released.

	You missed an important point about the mouseup message.  In order for
   buttons to work right, this must be (and is) true:  MOUSEUP IS ONLY SENT IF
   THE CURSOR IS STILL INSIDE THE BUTTON WHEN THE BUTTON IS RELEASED.  If this
   were not true, you could click inside a button and drag out of it and the
   button would still do its thing.  Try this on a standard button.  Try it on
   a standard go-away box.  (etc.)  The simple fact is, buttons are not menus-
   they are buttons.

	In a slightly less RTFM vein, you could do something like this:

   (in button script)
      on mousedown
	 global themenu
	 put the target into themenu
	 (display the menu)
      end
      on stilldown
	 global theitem
	 (figure out which item you're on)
	 (put some identifier for the item into theitem, including
	  an identifier that means "out of menu boundary")
      end stilldown
      on mouseup
	 global themenu
	 put zero into themenu
      end mouseup
      on domymenu
	 global theitem
	 (dispatch on theitem)
      end domymenu
      on idle
      end idle
   
   (in card/bkgd script)
      on idle
	 global themenu
	 if themenu <> zero then
	    send domymenu to themenu
	    put zero into themenu
	 end if
      end idle

	Of course, you could do all the dispatching from the higher level
   script, rather than sending "domymenu" to the button...

	In any case, this will do the right things--including doing nothing
   when the button is released in the menu header (the mouseup handler).  Note
   that idles are sent at the same time as stilldowns, so you need to swallow
   them in the button script.

	I typed this code in off the cuff, so it might not work verbatim, but
   it should be close.

-- 
pem@cadnetix.UUCP  (nbires!isis!ico!cadnetix!pem)
Technical Details
Message-ID: <896@cadnetix.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!nbires!isis!ico!cadnetix.UUCP!pem
References: <5236@jade.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!nbires!isis!ico!cadnetix.UUCP!pem
From: pem@cadnetix.UUCP (Paul Meyer)
Newsgroups: comp.sys.mac
Subject: Re: HyperTalk mouseUp message
Message-ID: <896@cadnetix.UUCP>
Date: Mon, 28-Sep-87 14:22:13 EDT
Article-I.D.: cadnetix.896
Posted: Mon Sep 28 14:22:13 1987
Date-Received: Wed, 30-Sep-87 01:31:39 EDT
References: <5236@jade.BERKELEY.EDU>
Reply-To: pem@cadnetix.UUCP (Paul Meyer)
Distribution: world
Organization: Cadnetix Corp., Boulder, CO
Lines: 67
Keywords: mouseUp,hypercard,hypertalk,apda,script language guide
Summary: RTFM, but here's some code that should help