Path: utzoo!utgpu!watmath!att!ucbvax!tut.cis.ohio-state.edu!cs.utexas.edu!utastro!james From: james@utastro.UUCP (James McCartney) Newsgroups: comp.sys.mac.programmer Subject: Re: Joe's bug list for the THINK Class Library, vol. 1 Summary: continuous thumb scrolling Message-ID: <4283@utastro.UUCP> Date: 30 Aug 89 22:31:54 GMT References: <3812@ncsuvx.ncsu.edu> Organization: U. Texas, Astronomy, Austin, TX Lines: 55 In article <3812@ncsuvx.ncsu.edu>, jnh@ecemwl.ncsu.edu (Joseph N. Hall) writes: > > 2. It would be nice to have a scroll bar that implemented the equivalent > of a TrackControl function for the thumb, so that the "live" thumb > dragging available on the NeXT, etc., could be implemented. > I did this in my own object library : HThumbScroll(this, cntl, where) hFrame this; ControlHandle cntl; Point where; { int pix; int value; long valrng, pixrng, vdown; Point mdown, mse; Box limits; /* normal way to do a thumb : TrackControl(cntl, where, NIL); value = GetCtlValue(cntl); Send(this, mPutOrigin, value, This.origin.v, true); */ /* fancy a la NeXT way : */ valrng = GetCtlMax(cntl) - GetCtlMin(cntl); pixrng = (**cntl).contrlRect.right - (**cntl).contrlRect.left - 48; mdown = where; vdown = GetCtlValue(cntl); limits = This.fbox; while(StillDown()) { FocusParent(this); GetMouse(&mse); pix = mse.h - mdown.h; /* calc control value : */ value = vdown + pix * valrng / pixrng ; /* move origin of frame, scrollrect contents */ Send(this, mPutOrigin, value, This.origin.v, false); /* keep track of update region */ HLock(this); SectRect(&limits, &This.fbox, &limits); HUnlock(this); } Focus(this); UpdateHandLimits(this, &limits); } Some of the above is probably not intelligible without seeing the rest of the code. but you get the general idea. I spent about 10 minutes looking at how to do it in the THINK class library before moving on to other things. --- James McCartney