Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!lll-winken!lll-lcc!ames!mailrus!uwmcsd1!nic.MR.NET!umn-d-ub!umn-cs!mmm!ems!srcsip!mnkonar From: mnkonar@srcsip.UUCP (Murat N. Konar) Newsgroups: comp.sys.mac.programmer Subject: CDEF's and Control Manager Message-ID: <8486@srcsip.UUCP> Date: 12 Sep 88 16:07:52 GMT Article-I.D.: srcsip.8486 Reply-To: mnkonar@srcsip.UUCP (Murat N. Konar) Organization: Honeywell Systems & Research Center, MPLS, MN Lines: 64 I am trying to write a CDEF and have run into a few places where there is an apparent inconsistency between IM's description of how the Control Manager interacts with CDEF's and reality. In particular: 1) When the CDEF is called with a message of drawCntl, the value of param is supposed to be the part code of the control to draw. The gotcha here (not mentioned in IM) is that the part code is in the low order word only so you must mask off the upper word or do something like thePartCode:=loWord(param) 2) The section titled "The Position Routine" (IM I-331) states that controls that don't use the Control Manager's default method of dragging must include a position routine. This implies that controls that DO use the default method DO NOT need a position routine, yet when I tell the Control Manager to use the default method (by returning zero in response to a dragCntl message), I am still receiving a posCntl message. Infact, if there is not a position routine, the indicator will not get updated. Apparently, using the default method of dragging does not exempt you from having to provide a position routine. 3) The section titled "The Thumb Routine" (I-332) says that the Thumb Routine is only needed for controls that don't use the Control Managers default method of dragging the indicator. This is contrary to what I have observed. It appears that you need the Thumb Routine ESPECIALLY if you use the default dragging method. And now a question: The sequence of messages that a CDEF receives when the Control Manager is executing the TrackControl function for a control that uses the default method of dragging is as follows: testCntl thumbCntl dragCntl calcCRgns posCntl {only if start Point <> end Point} The Control Manager uses dragGrayRgn to do the indicator dragging. If the start point (the point where the mouse was first pressed) is equal to the end point (point where mouse is released), TrackControl returns zero. If the start and end points are different and the end point is within slopRect, TrackControl returns the part code of the indicator. If I choose to do my own indicator dragging, I get the following message sequence: testCntl thumbCntl dragCntl but TrackControl returns zero no matter where I release the mouse. How do I tell the Control Manager what value TrackControl is supposed to return? If anybody could answer this question or point me to an authoritative source on writing CDEFs (I've already seen the MacTutor articles on definition functions, they are woefully inadequate) I'd really appreciate it. Respond either directly or via the net. Many thanks and a garland of Martian Fire Flowers in advance. BTW, I'm doing this in Lightspeed Pascal 1.11a on a 2meg MacII running System 5.0. _____________________________________________________________________ Sorry, no disclaimer.