Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect a CListCtrl selection change?

I want to execute some code when the user selects a row in a CListCtrl (report view, I don't care about the other viewing modes).

How do I catch this event? is there some message I can map or a method like "OnSelectionChanged" or something like that?

like image 888
rec Avatar asked Sep 22 '09 22:09

rec


1 Answers

Also try:

BEGIN_MESSAGE_MAP(cDlgRun, CDialog)     ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) END_MESSAGE_MAP()  /* ... */  void cDlgRun::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)  {     NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;      if ((pNMListView->uChanged & LVIF_STATE)          && (pNMListView->uNewState & LVIS_SELECTED))     {         // do stuff...     } } 
like image 134
djeidot Avatar answered Sep 25 '22 21:09

djeidot