[comp.windows.ms] SetScrollRange problems

carlc@mars.SanDiego.NCR.COM (Carl Christofferson) (03/16/90)

I have been trying to set the scroll bar range with SetScrollRange() on the
scroll bar of a listbox in one of my dialog boxes and have been getting
unexpected results.  I need to set the range on the list box because I may
have to display extremely large lists to the user in which case I'll have to
delete and add data as the user moves through the list (and I want the scroll
bar to move smoothly from the top for the 1st item to bottom for the last).  
So in SetScrollRange I set hWnd to the handle to the listbox, the nMinPos
to 0 and the nMaxPos to the number of strings to display.  However, I find
that the scroll bar thumb reaches the bottom of the bar before I get to the
bottom of the list (i.e. if there are 60 items to display, the thumb reaches
the bottom on item 40).  (BTW I can display 10 items at a time in the listbox.)
I have set the bRedraw flag both on and off with no difference.  nBar is
SB_VERT.

Can anybody tell me what I'm doing wrong?  Can you use SetScrollRange on a
listbox scroll bar in a dialog box?

Thanks in advance for any help with this!

Carl Christofferson
carlc@mars.SanDiego.NCR.COM
disclaimer:  Any opinions expressed are entirely my own ...