Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About selecting a MFC CListCtrl item

What I'm trying to do is select an item in a CListCtrl and make the selected item visible (scroll down). What is the best way to do this?

I have tried myListCtrl.SetItemState(idx, LVIS_SELECTED, LVIS_SELECTED) to select the item but I have to manually scroll down the ListCtrl to make it visible. There exists the function CListCtrl::GetTopIndex but I didn't find the counterpart SetTopIndex.

Many thanks for your help!

like image 566
Christian Ammer Avatar asked Feb 25 '23 03:02

Christian Ammer


1 Answers

You can try with EnsureVisible() http://msdn.microsoft.com/en-us/library/tbtcxzsf%28VS.80%29.aspx

like image 154
Felice Pollano Avatar answered Mar 01 '23 23:03

Felice Pollano