winmeister
asked on
Programmatically scroll in CListView
In a CListView, I can programmatically select an item by this instruction:
ListCtrl.SetItemState(nIte m,LVIS_SEL ECTED|LVIS _FOCUSED,L VIS_SELECT ED|LVIS_FO CUSED);
The matter is that if the item is not currently in view, the list control doesn't scroll.
Another problem (but reltaed to the first one) is that MFC has a CListCtrl::GetTopIndex() function, but doen't have the corresponding SetTopIndex().
How can I programmatically scroll the events in the ListCtrl associated with a CListView?
ListCtrl.SetItemState(nIte
The matter is that if the item is not currently in view, the list control doesn't scroll.
Another problem (but reltaed to the first one) is that MFC has a CListCtrl::GetTopIndex() function, but doen't have the corresponding SetTopIndex().
How can I programmatically scroll the events in the ListCtrl associated with a CListView?
Use CListCtrl::EnsureVisible() . You can make sure an item is visible and whether partially visible is okay or not.
ASKER
This is only partially true. How can I get the item as the first in the scroll view? I mean, I'd like to have a function similar to SetTopIndex(nItem).......
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.