Thanks for the response, DeAnna.  Getting the scrollbar drawn initially
isn't the problem - I do pretty much what you describe.

The problem is that "the proper values" for the scrollbar's "max value" and
"page size" variables are always approximate.  I don't know in advance of
rendering the entire page how many lines there are in it.  Due to the
effects of word-wrapping (and soon font and style changes), the number of
characters on each line is variable.

I just found a semi-acceptable solution, though.  I set the approximate
values at form init time, then I never update the scrollbars unless the "cur
value" and "max value" are the same but there is more text to see offscreen,
at which time I update the scrollbar with a re-approximated value for "max
value". 

This eliminates the "haywire" behavior I saw before, and allows scrolling
all the way to the end.  The drawback is that the scrollbar's "car" is never
very accurate, particularly at the moment when I update the scrollbar.  At
that moment, the car is at the end, and then jumps back a bit when I
re-approximate the "max value".

I think I'll try continuously re-approximating the "max value" next.

Mark Peters

in article 51946@palm-dev-forum, DeAnna Davidson at [EMAIL PROTECTED] wrote
on 6/6/01 11:02 AM:

> 
> Hi Mark,
> 
> I usually draw the first page, render an approximated scrollbar until
> after the page is drawn, and then update the scrollbars with the proper
> values after the document is drawn.  A bit hackish, but you don't have a
> blank screen and your bar is visible.
> 
> DeAnna
> 
> -----Original Message-----
> From: Mark A. Peters [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 06, 2001 2:02 PM
> To: Palm Developer Forum
> Subject: Scrollbars when line count unknown?
> 
> 
> Can anybody give me some advice on how to handle scrollbar updating when
> the
> exact size (in whatever units) of the thing being scrolled is not known,
> or
> too expensive to compute, and hence only approximations can be made?
> 
> [...]


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to