Vesselin Bontchev wrote:
> How do you display a list (not a field), scrollable with a scrollbar
> control instead of with the standard puny arrows?
> 1) The proper way to get rid of the puny arrows is by telling
> LstSetListChoices that the list has only as many elements as
> would fit on the screen (or less).
I think this seems pretty logical. I think I can see a pretty
straightforward way to make this work as long as you give up the
requirement that the user can drag within the list itself in
order to scroll. That part seems quite tricky.
To make the rest of it work, I think only one key insight is
required: it seems like it would help a lot not to think of
the scrollbar as scrolling. Instead, think of having multiple
different lists, and think of the scrollbar as *selecting* one
of the lists to be the one that gets displayed on screen.
Let's say you have a sequence of N items, and that sequence is
called S. And, let's say that you have a list gui object called
L which can only show M of those items. Then, there are N-M+1
subsequences that you can show in your list. We'll call that
number P (for possible lists), so P=N-M+1. If you number the
subsequences starting at zero, then you get this:
subsequence start end
----------- ----- ---
0 0 M-1
1 1 M
2 2 M+1
... ... ...
P-1 P-1 N-1
So, all you've got to do is set up a scrollbar whose possible
values range from 0 to P-1 and whose page size is M-1. Then
handle sclRepeatEvent, and every time the value changes, use
LstSetListChoices() to put a new subsequence of M items into
the list. That's all you've got to do, as far as I can tell.
Figuring out which item the user selected is a bit more complicated
than it normally is, but actually it's not that bad: you just
LstGetSelection() and add its result to the scrollbar's current
position, if you made the scrollbar zero-indexed.
- Logan
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/