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

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

Hello, everyone.  Thanks to the help of Brad Lowe, I've figured out the
problem I was having with scrolling a TextEdit record in a cdev.  The problem
is described in my previous posting.  Since I think that this might be 
useful to other people on the net, I thought I would post how I solved it.  

First of all, I guess the Control Panel does handles controls in the main
cdev DITL by itself, so if you have a scroll bar, your action procedure
only gets called when you let go of the mouse, because the Control Panel
doesn't return the hitDev message until that time.  So what I did was create
a user item with the same rect as the scroll bar, and with a LOWER item 
number.  That way, when you click anywhere on the scroll bar, the Control
Panel returns immediately with the hitDev message, and the user item in
itemHit.  From there, you can just act as if the click had been in the scroll
bar, and everything should work fine.  I think I changed about 2 lines in my
code, and it solved all of the problems I was having before.

Hope this is useful to some of you!

Jim Wintermyre
jwinterm@jarthur.claremont.edu