[comp.sys.mac.programmer] Help me understand MDEF 0 and scrolling menus

jcav@ellis.uchicago.edu (john cavallino) (03/08/91)

I've written a CDEF that implements the (latest) Apple Standard popup menu
interface (with the little arrow and everything).  It appeared to work
correctly, at least in my test program that I use for developing defProcs.
Now I'm trying to use this CDEF in one of my projects.  I want to put a
popup menu of file formats in the SFGetFile dialog box (see MacWrite II's
"Open" box).

The CDEF code calls the menu's MDEF to draw the selected menu item within
the control.  I do it by first calling the mPopup message to force the MDEF
to calculate the bounding box required to get the item to appear in correct
location.  Then I call the mDraw message, with clipping set to the control's
rectangle, supplying the rectangle that was returned by mPopup.  The problem
is that, in the Standard File dialog, the CDEF correctly draws the menu item
only if it is the LAST item in the menu.  If it is any other item, the
down-pointing menu scroll indicator (upside-down triangle) is drawn instead.
All menu items draw correctly if I run the CDEF in my defProc test shell.

I need someone possessing immense guru-osity to please explain what
incantations I need to perform when manually calling the standard MDEF. (ID0)
I know that the low-memory global "TopMenuItem" must be set up correctly
before mDraw is called.  I think (thought) I was doing that (I stuff in the
value returned by mPopup).  Evidently  the requirements are more subtle.


HELP!!!

-- 
John Cavallino                      |     EMail: jcav@midway.uchicago.edu
University of Chicago Hospitals     |    USMail: 5841 S. Maryland Ave, Box 145
Office of Facilities Management     |            Chicago, IL  60637
"Opinions, my boy. Just opinions"   | Telephone: 312-702-6900