[comp.sys.mac.programmer] Dragging problem in custom CDEF

pettinati_f@apollo.HP.COM (Fabio Pettinati) (08/05/89)

Organization: Hewlett-Packard Apollo Division - Chelmsford, MA

Hi,

I wrote a shaded scroll-bar CDEF to replace the standard one in
an application currently under development. This CDEF uses its
own thumb dragging mechanism, and not the standard one that involves
calling DragGrayRgn. When testing such CDEF with the TESample program
provided by DTS, I noticed that dragging the thumb was not making the
text in the window scroll. I tracked down the problem to where
TrackControl was being called. What happens is that TrackControl is
always returning 0 (zero) which is interpreted as "the mouse was released
outside the thumb, in which case the application should do nothing" (according
to IM-1).

This happens only if I implement my own dragging mechanism (by doing the
dragging myself and returning a non-zero value as a reply to the dragCntl
message). I discovered that if I use the standard dragging method (just
by returning zero as a reply to dragCntl), when the mouse is released,
the CDEF is called with messages calcRgns (#2) and posCntl (#5). These
two messages are not passed to the CDEF when I use my own dragging; this
means, the thumb region is not updated, and TrackControl thinks the mouse
was released outside the thumb.

So the question is: What am I forgetting? I looked at IM-1..4, Tech Notes,
MacTutor, etc but couldn't find any clues.

Suggestions and pointers are welcome.

Thanks,


Fabio Pettinati
Hewlett-Packard Apollo Division
pettinati_f@apollo.com