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?
In my case, I need to scroll formatted text similar to that displayed by
a
web browser, where the exact number of lines depends upon the fonts,
styles,
word-wrapping, etc. that are used within the document. Computing the
exact
size of the thing is too expensive, since it requires rendering the
entire
document before displaying the first page.
I've tried using approximations, but the methods I've tried cause the
scrollbars to go haywire, generating a large number of scroll repeat
events
all out of proportion to the scrolling actually done by the user. I
suspect
this is because the system's calculation of the scroll values (from the
distance the scroll bar has been dragged, I think) never matches
reality,
and changing it to match reality confuses it.
I always know the character position of the displayed lines within the
raw,
unformatted text, but that's it. I've tried setting the max value of
the
scrollbar to the length of the unformatted text minus about a page worth
of
text, and then always setting the current value to the index of the
first
character in the top displayed line. This causes the "haywire" behavior
described above.
By the way, I'm simply drawing the text to a form with no UI elements
(except the scrollbar) on it, i.e., I'm not using a field object. Also,
the
bad behavior only happens when I try to drag the scrollbar's car - it
behaves fine if I tap the scroll arrows.
Ideas?
Thanks,
Mark Peters
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/