gwowen@gpu.utcs.utoronto.ca (George Owen) (10/19/90)
.... is ther any way in HC 2.0 to determine if the mouse pointer
is in the menubar ? I know there is an 'on doMenu' but i was wondering
if the is any ' on pointer-within-the-menubar' ????
Why ? - long story , don't ask !! :-)
--
***************************************************************************
* George Owen (gwowen@gpu.utcs.utoronto.ca) *
* University of Toronto - Computing Services - Toronto , Canada *
***************************************************************************taylorj@yvax.byu.edu (10/19/90)
In <1990Oct18.171219.29303@gpu.utcs.utoronto.ca>, gwowen@gpu.utcs.utoronto.ca
(George Owen) asks if there is a way to tell if the pointer is in the menubar.
There's no message sent when the mouse pointer enters (or leaves) the menubar,
but you can write an idle handler to accomplish the same thing. Try this one:
on idle
global inMenuBar
if inMenuBar is empty then -- first time through
put (the mouseV + the top of card window < 20) into inMenuBar
end if
if the mouseV + the top of card window < 20 then
if not inMenuBar then
send mouseEnterMenu to this card
put true into inMenuBar
end if
else
if inMenuBar then
send mouseLeaveMenu to this card
put false into inMenuBar
end if
end if
end idle
This will send a message whenever the mouse enters or leaves the menubar. It
only sends the message once on each entry or exit (i.e. it won't continually
send the mouseEnterMenu message while the mouse is within the menubar), and it
initializes itself the first time through so no spurious message is sent even
if the mouse is already within the menubar.
I tested this, so I know it works.
Jim Taylor
Microcomputer Support for Curriculum |
Brigham Young University | Bitnet: taylorj@byuvax.bitnet
101 HRCB, Provo, UT 84602 | Internet: taylorj@yvax.byu.edujdevoto@Apple.COM (Jeanne A. E. DeVoto) (10/21/90)
In article <1679taylorj@yvax.byu.edu> taylorj@yvax.byu.edu offers an idle handler to detect when the pointer is in the menubar: >on idle > [. . .] > if the mouseV + the top of card window < 20 then > if not inMenuBar then > send mouseEnterMenu to this card > put true into inMenuBar > end if > [. . .] To get even fancier, for the case in which you're running on a system with multiple monitors, you'll need to test the horizontal position also (to determine whether the pointer is on the main monitor): if (the mouseV + the top of card window < 20) and ~ (the mouseH > item 1 of the screenRect) and ~ (the mouseH < item 3 of the screenRect) then [ etc ] -- ========= jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.sf.ca.us | compilation copyright without my permission. ______________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. |