[comp.sys.mac.programmer] Variable-sized elevators

ws0n+@andrew.cmu.edu (Walter Ray Smith) (04/26/88)

> *Excerpts from: 22-Apr-88 Re: MultiFinder switch bug .. Alexander*
> *Rosenberg@ucsc (1134)*

>    What's the deal with scroll bars? When they CDEF got updated to work with
> the new control manager color support, why didn't it also get the variable
> elevator sizing as found on the //gs and GEM? (sorry to say that, but it
> has it and we don't...)

How do you propose to do that?!  Variable elevator sizing requires some idea of
the size of the visible area relative to the view size--the scroll bar has to
have four parameters.  The Control Manager dictates that each control has a
min, a max, and a value--three parameters.

You could make a new control with some hack to get the elevator size into it,
but I don't see how you could retrofit that functionality into CDEF 1.  How
would you get the applications to tell you how big to make the elevator?

- Walt

alibaba@ucscb.UCSC.EDU (Alexander M. Rosenberg) (04/26/88)

This is really neat. Think of the following:

ratioBits := (sBarTop.Y-sBarBot.Y)/ABS(sBarMax-sBarMin)

value := ratioBits * (sBarTop.Y-sBarBot.Y)
(This is all from memory, so I may be mesing it all up....)

value is the height in pixels of a scroll bar "page". This is also the
elevator height. QED. (Again, I think that this is wrong, but I don't got
time now to look it up, ST:TNG is starting...)


-------------------------------------------------------------------------------
-  Alexander M. Rosenberg  - INTERNET: alibaba@ucscb.ucsc.edu   - Yoyodyne    -
-  Crown College, UCSC     - UUCP:...!ucbvax!ucscc!ucscb!alibaba- Propulsion  -
-  Santa Cruz, CA 95064    - BITNET:alibaba%ucscb@ucscc.BITNET  - Systems     -
-  (408) 426-8869          - Disclaimer: Nobody is my employer  - :-)         -
-                          - so nobody cares what I say.        -             -

ws0n+@andrew.cmu.edu (Walter Ray Smith) (04/28/88)

> *Excerpts from: 26-Apr-88 Re: Variable-sized elevators Alexander*
> *Rosenberg@ucsc (881)*

> ratioBits := (sBarTop.Y-sBarBot.Y)/ABS(sBarMax-sBarMin)
> value := ratioBits * (sBarTop.Y-sBarBot.Y)

You're assuming that the programmer is using view y-coordinates as the scroll
bar limits.  That's a bad assumption.  It will work occasionally, but when it
doesn't work, it will be awfully confusing.  For example, it won't work in most
word processing programs--if their scroll bars worked that way, they could only
edit 80-page documents (65536 pixels long)...

But go ahead and do it; it will be interesting, at least.  You could paste it
into applications where it worked, and leave the rest alone.

- Walt

oster@dewey.soe.berkeley.edu (David Phillip Oster) (04/30/88)

Variable sized elevators can be built into any program you write, but they
will not work in general if you just make a new CDEF and paste it into
an arbitrary program.

Certainly, you can't expect it to work if you paste it into one of my text
editors:
1.) the scrollbar counts lines.
2.) because of multiple font sizes, the lines are variable widths

here is an example:
suppose that I have a file consisting of 
1 line of 72 point font followed by
20 lines of 6 point font

if I scroll off the first line, then all the remaining lines fit in the
window, so my CtlMax is 1. But, that one line may keep 5 lines from
showing.
The part of the document that is visible if it is showing is 
(72+15*6) / (72+20*6) = 0.8.. of the whole document
so I expect the elevator to show me
that.  The CDEF has no idea that I am scrolling a collection of variable
sized objects, so it certainly can't know about my 0.8 unless I
tell it. In my own program, I can easily extend my controls to have more
data, and add a SetCtlThumbWidth() and GetCtlThumbWidth(), but in general,
anyone pasting into my programs is in for a surprise.

--- David Phillip Oster            --When you asked me to live in sin with you
Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth.
Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu

alibaba@ucscb.UCSC.EDU (Alexander M. Rosenberg) (05/01/88)

Yes, I did realize this later, as I thought about the Integer limit on the
values.

How is this for an idea:

Either use a pair of procedures/functions to let the program do the calculation,
or, use the RefCon value as a handle to a secondary record, containing
settable values for the eleator height, and allow for future expansion?

Also, I am thinking of writing a CDEF that looks like the new OPEN LOOK
scroll bars. They are fantastic! The changes are logical, although deep
consideration of certain elements must be made, as always. I have only
seen them in like Infoworld or MacWeek, and not actually clicked on them,
but I like the idea of a cluster that moves, instead of a seperate set of
controls. (of course, the cluster should size to the page height, as I
think all scroll bars should... If I make that improvement, do you think
it is significantly different enough??? I would just use the cluster concept,
which cannot possibbly be patented by now...)

Ideas? Words of encouragment? A job?

-------------------------------------------------------------------------------
-  Alexander M. Rosenberg  - INTERNET: alibaba@ucscb.ucsc.edu   - Yoyodyne    -
-  Crown College, UCSC     - UUCP:...!ucbvax!ucscc!ucscb!alibaba- Propulsion  -
-  Santa Cruz, CA 95064    - BITNET:alibaba%ucscb@ucscc.BITNET  - Systems     -
-  (408) 426-8869          - Disclaimer: Nobody is my employer  - :-)         -
-                          - so nobody cares what I say.        -             -