[comp.sys.mac.programmer] Controling the Balloon Help Manager

schorsch@oxy.edu (Brent William Schorsch) (05/22/91)

Just a few questions for those few (in this early 7.0 stage) in the know:
Does the Help manager look at MenuDisable to determine which baloon/resource
to display?  If so, does this "looking" occur before or after MenuHook
is called?

Obviously, I am trying to "coerce" the Help Manager to display a balloon
not associated with the actual menuitem the cursor is over.  (I do have
a valid reason for doing this; I'm not making any virus to really confuse
new 7.0 users!!!)

If, of course, I'm barking up the wrong tree please let me know (and
if you know I'm barking up the wrong tree, you probably know which
tree I should be barking up and may want to tell me so...)

Thanks...   'The Tweaker'

alexr@apple.com (Alexander M. Rosenberg) (05/25/91)

In article <169760@tiger.oxy.edu>, schorsch@oxy.edu (Brent William Schorsch) writes:
> 
> Just a few questions for those few (in this early 7.0 stage) in the know:
> Does the Help manager look at MenuDisable to determine which baloon/resource
> to display?  If so, does this "looking" occur before or after MenuHook
> is called?
> 
> Obviously, I am trying to "coerce" the Help Manager to display a balloon
> not associated with the actual menuitem the cursor is over.  (I do have
> a valid reason for doing this; I'm not making any virus to really confuse
> new 7.0 users!!!)
> 
> If, of course, I'm barking up the wrong tree please let me know (and
> if you know I'm barking up the wrong tree, you probably know which
> tree I should be barking up and may want to tell me so...)
> 
> Thanks...   'The Tweaker'
> 

The System's MDEF "Menu Definition" resource calls the Help Manager routine,
HMShowMenuBalloon. 

>From Inside Mac VI (typing errors may be possible):

FUNCTION HMShowMenuBalloon (itemNum : INTEGER; itemMenuID : INTEGER; itemFlags
 : LONGINT; itemReserved : LONGINT; tip : Point; alternateRect : RectPtr;
tipProc : Ptr; theProc : INTEGER; Variant : INTEGER) : OSErr;

There are some caveats about showing menu balloon. I don't know all of them,
and I haven't played with this routine enough to know (but I have patched it
before!).

You should read the Help Manager section in Inside Mac VI. Mac DTS supposely
will also send you some hints about doing this in your own MDEF. (They give
out "sanitized" MDEF source, I believe.)

---------------------------------------------------------------------------
-  Alexander M. Rosenberg  - INTERNET: alexr@apple.com      - Yoyodyne    -
-  330 1/2 Waverley St.    - UUCP:ucbvax!apple!alexr        - Propulsion  -
-  Palo Alto, CA 94301     -                                - Systems     -
-  (415) 329-8463          - Nobody is my employer so       - :-)         -
-  (408) 974-3110          - nobody cares what I say.       -             -

carr@apple.com (Randy Carr) (05/29/91)

In article <13645@goofy.Apple.COM>, alexr@apple.com (Alexander M. Rosenberg) writes:
> 
> In article <169760@tiger.oxy.edu>, schorsch@oxy.edu (Brent William Schorsch) writes:
> > 
> > Just a few questions for those few (in this early 7.0 stage) in the know:
> > Does the Help manager look at MenuDisable to determine which baloon/resource
> > to display?  If so, does this "looking" occur before or after MenuHook
> > is called?
> > 
> > Obviously, I am trying to "coerce" the Help Manager to display a balloon
> > not associated with the actual menuitem the cursor is over.  (I do have
> > a valid reason for doing this; I'm not making any virus to really confuse
> > new 7.0 users!!!)
> > 
> > If, of course, I'm barking up the wrong tree please let me know (and
> > if you know I'm barking up the wrong tree, you probably know which
> > tree I should be barking up and may want to tell me so...)
> > 
> > Thanks...   'The Tweaker'
> > 
> 
> The System's MDEF "Menu Definition" resource calls the Help Manager routine,
> HMShowMenuBalloon. 
> 
> >From Inside Mac VI (typing errors may be possible):
> 
> FUNCTION HMShowMenuBalloon (itemNum : INTEGER; itemMenuID : INTEGER; itemFlags
>  : LONGINT; itemReserved : LONGINT; tip : Point; alternateRect : RectPtr;
> tipProc : Ptr; theProc : INTEGER; Variant : INTEGER) : OSErr;
> 
> There are some caveats about showing menu balloon. I don't know all of them,
> and I haven't played with this routine enough to know (but I have patched it
> before!).
> 
> You should read the Help Manager section in Inside Mac VI. Mac DTS supposely
> will also send you some hints about doing this in your own MDEF. (They give
> out "sanitized" MDEF source, I believe.)
> 
> ---------------------------------------------------------------------------
> -  Alexander M. Rosenberg  - INTERNET: alexr@apple.com      - Yoyodyne    -
> -  330 1/2 Waverley St.    - UUCP:ucbvax!apple!alexr        - Propulsion  -
> -  Palo Alto, CA 94301     -                                - Systems     -
> -  (415) 329-8463          - Nobody is my employer so       - :-)         -
> -  (408) 974-3110          - nobody cares what I say.       -             -
> 
> 

Alex is indeed right, the Help Mgr calls the HMShowMenuBalloon() function
directly from the MDEF.  It passes the menu flags long word to the Help Mgr
and that flags long contains the enabled/disabled info for each item in the
menu.  The other thing that involves the decision of what 'hmnu' resource to
use is whether an application has called HMSetMenuResID() or not. (the
HMSetMenuResID() call allows the remapping of menu id to resource id)

An MDEF can also call HMShowBalloon() with the method parameter equal to
kHMSaveBitsNoWindow.  In this way there is no association with an 'hmnu' 
resource for a menu item balloon.

Randy Carr
System Software
Apple Computer, Inc.

P.S. I wrote the Help Mgr.