Newsgroups: comp.sys.mac.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!ml27192
From: ml27192@uxa.cso.uiuc.edu (Mark Lanett)
Subject: Re: MacApp scrolling of indefinite sized views
Message-ID: <1991Apr3.061733.18937@ux1.cso.uiuc.edu>
Keywords: MacApp TScroller
Sender: usenet@ux1.cso.uiuc.edu (News)
Organization: University of Illinois at Urbana
References: <1991Apr2.233513.18137@d.cs.okstate.edu>
Date: Wed, 3 Apr 1991 06:17:33 GMT
Lines: 46

norman@d.cs.okstate.edu (Norman Graham) writes:

>I have a colleague that needs to provide a scrollable view for a
>special kind of container object. This container object is unique
>because it doesn't know how big it is or how many elements it contains, 
>but it can return the element that is say 33% from the beginning
>of the container. (When asking for an element based on a percentage,
>the container can only take a guess which, in extreme circumstances,
>can be way off.) The container also has a notion of a current element and
>can get the previous, next, first, and last elements; so in theory
>you could count all the elements, but in practice that would take far
>too long.

>My colleague would like to create a subclass of TScroller that can
>scroll views of these container objects, but he can't find a class
>definition that cleanly describes what he needs. In short, his definition
>requires the scroller object to communicate directly with the container
>object. The view that sits on the scroller object also communicates with
>the container object (you would expect this). BTW, since the size of 
>the container object is indefinite, the container view has to be either
>the same size as the scroller or the maximum possible view size.

>Would anyone care to enlighten us on how this should be done?
>-- 
>Norman Graham

><norman@a.cs.okstate.edu>                 Standard Disclaimer Applies
>{cbosgd,rutgers}!okstate!norman

I haven't (fortunately) needed to subclass TScroller yet, so I don't know what
I'm talking about :-) but...
1) it seems that if the view can deal with things properly, scrolling should
work automatically. How do you draw your view when you get an area? If you
just have have an arbitrarily sized view, then you interpolate the area
received to determine your percentages, and draw items starting from there. It
seems nasty, though, since scrolling could cause one item to be listed twice,
or not at all, depending on how sensitive your "guessing" is.
2) If you must, connecting the TScroller to the container isn't that bad. This
makes things easy since when you get a scroll down you know to just increment
and go draw the "next" element--no saying "where am I". In this case the 
scroller tells the view exactly what to draw rather than sending an update.
3) Must you display the list directly or could you pull sublists out based
on some criteria and display them?
--
//-----------------------------------------------------------------------------
Mark Lanett						ml27192@uxa.cs.uiuc.edu
