Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!gatech!hubcap!mikeoro From: mikeoro@hubcap.UUCP (Michael K O'Rourke) Newsgroups: comp.sys.mac.programmer Subject: CDEF problems (round 3) Keywords: CDEF Message-ID: <4327@hubcap.UUCP> Date: 6 Feb 89 20:28:46 GMT Organization: Clemson University, Clemson, SC Lines: 41 Okay, here we go again. But first I'd like to thank all who responded to my earlier problems, you really did help a lot. I am writing a PICT button control definition function (CDEF). Thanx to the previous responses to my questions, and a lot of hard word, I was able to figure out that my button needed to return a value <128 in the Test function. I chose 22. I also figured out that my CDEF needed to do its highlighting in the Draw Function since i have special highlighting. I went and made these changes, except for the highlighting, and everything worked great. TrackControl would return a 22 if i let go within the button and a 0 otherwise. However, when I put in my tracking code into Draw, things got weird. Now TrackControl always returns a 22. Whatz up? My Tracking code is very simple: high := 0; while StillDown do begin GetMouse(MLoc); if (high and not PtInRect(MLoc,theControl^^.contrlRect)) then begin high := false; invertRect(theControl^^.contrlRect); end else if (not high and PtInRect(MLoc,theControl^^.contrlRect)) then begin high := true; invertRect(theControl^^.contrlRect); end; end; if high then invertRect(theControl^^.contrlRect); Does anyone see anything wrong with this? Could using StillDown be messing with some globals that screw up TrackControl or the value that the CDEF returns?I just don't understand why adding this little chunk of code completely messes up the value returned to TrackControl. Desperately awaiting a logical reply, Michael O'Rourke