Important: The information in this document is obsolete and should not be used for new development.
HMShowMenuBalloon
The Help Manager displays help balloons for applications that provide'hmnu'resources and use the standard menu definition procedure. If your application uses your own menu definition procedure, you can still use the Help Manager to display help balloons for the menus that your menu definition procedure manages. Use theHMShowMenuBalloonfunction to display balloons described by the standard balloon definition function. If you want to use your own balloon definition function from within your menu definition procedure, call theHMShowBalloonfunction (described in the previous section) and specify thekHMSaveBitsNoWindowconstant for themethodparameter. You can also use theHMShowMenuBalloonfunction as an alternative to creating an'hmnu'resource for your menu.
FUNCTION HMShowMenuBalloon (itemNum: Integer; itemMenuID: Integer; itemFlags: LongInt; itemReserved: LongInt; tip: Point; alternateRect: RectPtr; tipProc: Ptr; theProc: Integer; variant: Integer): OSErr;
itemNum- The number of the menu item over which the cursor is currently located. Use a positive number in the
itemNumparameter to specify a menu item, use -1 if the cursor is located over a divider line, or use 0 if the cursor is located over the menu title.itemMenuID- The ID of the menu in which the cursor is currently located.
itemFlags- A long integer from the menu flags, telling whether a menu item is enabled or dimmed and whether the menu itself is enabled or dimmed. The Help Manager uses this value to determine which balloon to display from the
'hmnu'resource.itemReserved- Reserved for future use by Apple. Specify 0 in this parameter.
tip- The tip for the help balloon. The standard menu definition procedure places the tip 8 pixels from either the right or left edge of the menu item. For menu titles, the standard menu definition procedure centers the tip at the bottom of the menu bar; you should not specify a tip with coordinates in the menu bar for any menu titles.
- The Help Manager uses the tip you specify in this parameter unless it places the help balloon offscreen or in the menu bar. If the tip is offscreen, the Help Manager uses the rectangle specified in the
alternateRectparameter to calculate a new tip location.alternateRect- The rectangle that the Help Manager uses to calculate a new tip location. (The standard menu definition procedure specifies the alternate rectangle as the rectangle that encloses the menu title or menu item.) If the balloon's first position is offscreen or in the menu bar, the Help Manager tries a different balloon variation code or calculates a new tip by transposing it to an opposite side of the alternate rectangle. If you specify
NILfor thealternateRectparameter, the Help Manager does not attempt to calculate a new tip position when the help balloon is offscreen.tipProc- The tip function that the Help Manager calls before displaying the balloon. Specify
NILto use the Help Manager's default tip function, or supply your own tip function and point to it in this parameter.theProc- Reserved for use by Apple. Specify 0 in this parameter.
variant- The variation code for the standard balloon definition function. Specify 0 to use the default balloon position or a code between 1 and 7 to use one of the other standard positions shown in Figure 3-4 on page 3-9.
DESCRIPTION
TheHMShowMenuBalloonfunction saves the bits behind the help balloon before displaying the help balloon. When you remove the balloon, the Help Manager restores the bits that were previously behind it.After your menu definition procedure determines that the cursor is located in a menu item, you can use the
HMShowMenuBalloonfunction to display any help balloons associated with that item. You must then use theHMRemoveBalloonfunction to remove the balloon when the cursor moves away from the menu item.If you use the
HMShowMenuBalloonfunction to display help balloons, you must identify hot rectangles, create your own data structures to store their locations, track the cursor yourself, and callHMShowMenuBalloonwhen the cursor moves to your hot rectangles. The Help Manager does not know the locations of your hot rectangles, so it cannot use them for moving the tip if the balloon is placed offscreen. Instead, the Help Manager uses the alternate rectangle that you point to with thealternateRectparameter.Unlike the way the
alternateRectparameter works in theHMShowBalloonfunction, specifying an alternate rectangle toHMShowMenuBalloondoes not cause the Help Manager to track the cursor and remove the balloon for you. You must still track the cursor and use theHMRemoveBalloonfunction to remove the balloon when the cursor moves out of the area specified by the hot rectangle.Specify
NILin thetipProcparameter to use the tip function values calculated by the Help Manager. If you supply your own tip function and specify it in thetipProcparameter, the Help Manager returns the tip, the region boundary of the entire balloon, the region boundary for the content area within the balloon frame, and the variation code to be used for the help balloon before displaying it. This allows you to examine and possibly adjust the balloon before it is displayed.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theHMShowMenuBalloonfunction are
Trap macro Selector _Pack14 $0E05 RESULT CODES
SEE ALSO
You can supply your own tip function (as explained in the description of theMyTipfunction, which begins on page 3-122) and point to it in thetipProcparameter.The
HMRemoveBalloonfunction is described next.