[comp.sys.mac.programmer] Changing the size of the scroll box.

rapickering@miavx1.acs.muohio.edu (07/15/90)

Does anyone know how to make scroll bars that resize?

Let me clarify, the little scroll box that the mac uses is always the same
size.  I read somewhere that Apple does support having the scroll box change 
it's size depending on the percentage of text in the window in relation to the 
total amount of text in the file. 

    If you've ever used one of the lesser systems, like a NeXT or an ATARI ST,
you'll know what I'm talking about.

    Anyhow, I'd like to write a little text editor that would change the size 
of the scroll box.

	Any help would be appreciated.

		-Rob

oster@well.sf.ca.us (David Phillip Oster) (07/18/90)

You want the ratio of the size of the thumb to the size of the scroll bar
to equal the ratio of the size of the visible portion of the window to the
total size of the window. This is a nice idea, since in the extreme cases,
a very large document, so only a small portion is visible: the default
size thumb is drawn, and a very small document, so it is entirely visible:
the thumb fills the whole scroll bar, you give the user exactly what he is
getting now.

Unfortunately, The control manager's interface only provides
SetCtlMin, SetCtlMax, and SetCtlValue. You could always implement your
own control that had extra parameters in a structure off the Control's
refcon (that way programs that look at your controls to send your window
messages, like Apple's Virtual User test software would continue to work.)

Don't forget, many programs calibrate their controls in lines (i.e., one
click in the arrow move you up or down by one line) but the lines
are variable width. (i.e., 100 4-point high lines, followed by 1 100-point
high line. Since you must SetCtlMax to that when the Ctl is maxed out the
end of the document just brushes the end of the window, you already have to
worry about this non-linearity even with Apple's scroll bars.

The point is, it isn't simple, and if you did it, it would only work in
YOUR programs, and it is a lot of work. Go ahead.
-- 
-- David Phillip Oster - Note new address. Old one has gone Bye Bye.
-- oster@well.sf.ca.us = {backbone}!well!oster