#SetScrollPos help
2 messages in this thread
Lei,
>>
I am using CMyListBox : public CListBox and subclass the listbox
template control ID within the view. While I am handle OnVScroll,
SetScrollPos don't work at all.(this is a windows scroll bar, not a
control scroll bar). It seems like I need PostMessage to set scroll
positions. I just cann't find the right message to do so.
<<
I assume that what you've subclassed is a listbox with its own
scroll bar (so you get WM_VSCROLL messages when you click on the
buttons, etc.).
If you've done so, then you should be able to handle WM_VSCROLL
without any problem, as long as you call the base class OnVScroll
as well, to let the listbox do its own handling.
If you're getting WM_VSCROLL and attempting to change the scroll
position of the listbox's scroll bar yourself, you might very well
be making internal variables the listbox is keeping to specify its
state invalid. I can't really suggest any way to change the
listboxes scroll position which might not mess this up, besides
possibly sending it LB_SETSEL or LB_SETTOPINDEX messages to
position particular items and thus force the listbox where you
wish.
Hope this information helps.
Tarn Faulkner
Microsoft Developer Support