home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!pagesat!spssig.spss.com!uchinews!quads!sgl1
- From: sgl1@quads.uchicago.edu (steven gregory lane)
- Newsgroups: comp.sys.mac.programmer
- Subject: Custom defProc questions
- Message-ID: <1993Jan25.214310.19476@midway.uchicago.edu>
- Date: 25 Jan 93 21:43:10 GMT
- Sender: news@uchinews.uchicago.edu (News System)
- Reply-To: sgl1@midway.uchicago.edu
- Organization: University of Chicago
- Lines: 37
-
-
- I've been encountering some problems with various custom
- definition procedures. I'd love to hear from anyone who may have
- experienced similar difficulties, or who has any explanation for some
- of the strange behavior I've encountered.
- My first problem occurred while I was trying to build a custom
- CDEF under Think C 5.0x. I was using a trick culled from the Think
- Reference which allows me to keep the CDEF code in my main
- segment by packaging a JMP instruction, together with the
- procedure's address, and putting the resulting value into the control's
- contrlDefProc field ( Think Ref 1.0 under "Custom Menus" ). The
- problem is that, when I use this scheme, the CDEF never receives the
- "initCntrl" message, which I use to initialize handles to various
- regions of the control. The first message received is always
- "drawCntrl," which tries to operate on uninitialized handles, and
- crashes messily.
- BUT -- if I build the CDEF in a separate file, compile it as a CODE
- resource, install it in the project's resource file and set my CNTL
- resource's procID accordingly . . . it all works fine. Anyone know why
- the initCntrl message isn't getting sent when the code's in my
- program's main segment?
- Here's another one. I was working with a popup Menu, which
- had a custom MDEF attached. I had the MDEF installed in the main
- segment, as above. In the course of debugging I noticed the MDEF
- was receiving some messages that weren't documented. The new
- "Toolbox Essentials" book documents messages 0-3 for MDEFs. I was
- getting 4s and 5s, sometimes two or three in a row. I looked in the
- header files, and they were defined there -- I believe they were a
- couple of "calcRgn" messages of the sort found in CDEFs. But no
- documentation anywhere. Can anyone tell me why my MDEF
- received these, and what I do with em?
- A last question on popup menus; the menu in question displays
- a grid of icons from which the user can choose. Ideally the menu
- would display the currently selected icon when the menu is sitting
- there inactive, in the same way it would display the current text
- item. Nothing in the Apple documentation seems to cover this. Any
- ideas?
-