home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!usc!sdd.hp.com!ncr-sd!sagpd1!bberqu
- From: bberqu@sagpd1 ()
- Subject: Popup menus (help!!)
- Message-ID: <1992Aug31.173244.1282@sagpd1>
- Keywords: popup
- Date: Mon, 31 Aug 1992 17:32:44 GMT
- Lines: 42
-
-
- Hi,
-
- I have three popup menus within a dialog box and am trying to figure out
- the best way to handle them, I know system 7 has support for them, but
- I would like my application to work with earlier versions of the OS also.
-
- Here's how I'm doing it, I create the static text to the side of the
- popupmenu with ResEdit (using DITL/DLOG editor), and also the popup menus
- (with the Menu editor). Since I don't know the width of the menus in
- ResEdit to make boxes for the popupmenus to the right of the static text
- as user Items, I calculate in my program based on where the static text
- item's rect is and the width of the popup menu, the rectangle for the popupmenu.
- I also create a control for the popup menu for that rectangle and store
- the menuhandle in the control's refcon field. Everything works fine up to
- this point, handling them is another story.
-
- It seems like all I should have to do to handle popup menus is when
- ModalDialog detects an event within the dialog it should pass the
- information to my filterProc function. If I know where the event happened
- and the dialog pointer I could call FindControl which would return me the
- control, and I've previously stored the menu handle in the control refcon
- field, so then I could simply call PopMenuSelect with the controls rect
- and the menuhandle, however I don't, understand CDEFs so FindControl
- doesn't seem to be returning the control handle, also ModalDialog does not
- seem to be passing me the dialog pointer (should it be?). I suspect
- FindControl is not finding the control because of my CDEF (it doesn't do
- anything right now but return 1). I know very little about CDEFs, IM
- doesn't seem to explain them very well (at least I don't understand them),
- I looked for information on them in bookstores over the weekend, but
- with no luck.
-
- Am I on the right track or totally off base. If I'm on the right track,
- could somebody please explain CDEFs or point me to a good book on the
- subject and if ModalDialog will give me the information I need to do this.
- I also don't understand how ModalDialog works either, but somebody explained
- at least how the ModalDialog and filterProc functions work together.
- If I'm off base, please give me some info on how you would do it.
-
- Thanks in advance, sorry for the long mail and hope its understandable.
-
- Brian
-