[comp.sys.mac.programmer] Scrolling text in cdev?

jwinterm@jarthur.Claremont.EDU (Jim Wintermyre) (04/15/91)

Hi!  Can somebody please help me?

I'm tring to create a help system for a cdev by using a TextEdit record with
text from a resource.  The problem I am having is in scrolling the text.  If
the user clicks in the scroll bar, I get the hitDev message from the Control
Panel.  I then get the mouse location, and call FindWindow to find out which
part of the scroll bar they clicked in.  If it WASN'T the thumb, I call
TrackControl with a pointer to my action procedure.  It seems that my action
procedure is only getting called ONCE, no matter how long I hold the mouse 
down.  For example, if I click in the down arrow in the scroll bar, it gets
highlighted for however long I hold down the mouse, but the text doesn't 
scroll until I let go of the mouse button.  There's also a problem with
using the thumb.  First of all, I call TrackControl with a nil action
procedure.  Now, if the thumb is actually moved to a new position, 
TrackControl should return a non-zero value, right?  Well, it seems to return
zero all the time.  So for now, I just scroll after calling TrackControl for
the thumb all the time, which seems to work okay, normally.  But there's 
another problem.  You know how there's a "slop rect" around the scroll bar
that allows you to click on the thumb, then move it even if you move the 
mouse outside the thumb (or the scroll bar itself) but are still within this
slop rect (the dotted outline of the thumb disappears when you move outside
the slop rect)?  Well, as long as I release the mouse OVER the thumb when I
move it, the text scrolls correctly.  But if I release the mouse in the slop
rect, the text doesn't scroll.  The way I determine how much to scroll the
text is by looking at the control value of the scroll bar (the maximum
value is equal to the total height of all the lines in the TextEdit record,
minus the height of the view rect).  So it seems that the control value of
the scroll bar isn't getting updated in this case.

Does ANYONE out there know what is going on here?  I've tried the code I'm
using in a normal application, and it works perfectly!  So it seems to be
some kind of cdev weirdness.  Any comments, suggestions, code or whatever
would be greatly apprectied.

Jim Wintermyre
jwinterm@jarthur.claremont.edu