[comp.sys.mac.hypercard] Scrolling Multiple Fields

ian@ukfca1 (Ian Sheppard) (01/09/90)

Can anyone help me with this problem ??

I'm trying to get multiple fields to scroll together. i.e. clicking in one
scrollbar would scroll all the fields the same number of lines in the same
direction at the same time !!. I think I probably need to use multiple
scrollable fields, have only one scrollbar visible (hide the other scrollbars
by overlapping the fields) and achieve the scrolling by modifying the scroll
value of the fields.

However, how do I trap the fact that the scrollbar is active, e.g. the up
or down arrow being pressed, or the elevator having been moved. Even with the
fields locked, I don't seem to get mouseDown etc. type messages.

Does anyone have a script, (or even better an Xcmd because that should be
faster) that will solve this problem ?

	Thanks in advance,

		Ian Sheppard.



--------------------------------------------------------------------------------
Ian Sheppard,
Schlumberger Technologies, ATE Division
Wimborne, Dorset BH21 7PP, England.
sheppard%ukfca1@sj.ate.slb.com
Phone: +44-202-893535

tim@hoptoad.uucp (Tim Maroney) (01/09/90)

In article <419@chervil.UUCP> sheppard%ukfca1@sj.ate.slb.com writes:
>I'm trying to get multiple fields to scroll together. i.e. clicking in one
>scrollbar would scroll all the fields the same number of lines in the same
>direction at the same time !!. I think I probably need to use multiple
>scrollable fields, have only one scrollbar visible (hide the other scrollbars
>by overlapping the fields) and achieve the scrolling by modifying the scroll
>value of the fields.

That works.  I've done it.  It's too slow, though.

>However, how do I trap the fact that the scrollbar is active, e.g. the up
>or down arrow being pressed, or the elevator having been moved. Even with the
>fields locked, I don't seem to get mouseDown etc. type messages.

I don't show a real scroll bar at all.  The rightmost field's scroll bar
is covered by lookalike buttons.  These button scripts set the scrolling
of all the fields.

>Does anyone have a script, (or even better an Xcmd because that should be
>faster) that will solve this problem ?

What I've given you should be enough to solve the problem yourself.
However, note the speed problems.  HyperCard 2.0 may be fast enough,
or it may not.  An XCMD is not necessarily noticeably faster than a
script; if most of what it does is pass script lines to the
interpreter, then you might as well just use a script.  There's no way
to directly access properties like "the scroll" from an XCMD, so I
don't see how you'll get much improvement.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Something was badly amiss with the spiritual life of the planet, thought
 Gibreel Farishta.  Too many demons inside people claiming to believe in
 God." -- Salman Rushdie, THE SATANIC VERSES

tomj@oakhill.UUCP (Tom Johnson) (01/09/90)

In article <419@chervil.UUCP> sheppard%ukfca1@sj.ate.slb.com writes:
>Can anyone help me with this problem ??
>
>I'm trying to get multiple fields to scroll together. i.e. clicking in one
>scrollbar would scroll all the fields the same number of lines in the same
>direction at the same time !!. I think I probably need to use multiple
>scrollable fields, have only one scrollbar visible (hide the other scrollbars
>by overlapping the fields) and achieve the scrolling by modifying the scroll
>value of the fields...[rest of message deleted]
>
>
>Ian Sheppard,
>sheppard%ukfca1@sj.ate.slb.com

I needed to do exactly this same thing only about a week ago.  I also grappled
with the problem, and finally came up with the following solution (albiet not
perfect)...I created my four scrolling fields, overlapping each so that only
a single scroll bar (the one farthest to the right) was showing.  This scroll
bar was then covered with an empty, non-scrollable, opaque field, which was
sized to allow the top, right, and left borders of the scrollable field to
show (made things look more polished).  Buttons were then added to the top
(a scroll-up button), and bottom (a scroll-down button) of this opaque field.
The button handlers take care of setting the scroll of all of the scrollable
fields.

Note that all of my fields were locked, although this doesn't really matter,
and all of the fields and buttons were background.  If you could afford to
make the "scroll bar" in the foreground, then instead of using an opaque field,
you could add a painted gray pattern to cover the rightmost scroll bar, and
add not only the scroll-up and scroll-doen bottons, but also a thumb button,
adjusting its relative position each time you scroll (just like a "real" scroll
bar).

Hope this helps some, or puts you on the right path, or whatever.

Tom Johnson
tomj@oakhill.UUCP
Motorola, Inc.
Austin, TX

Disclaimer:  Motorola doesn't speak for me, and visa-versa.