Dave's Brain

Browse - Programming Tips - A row is only selected when I click on the label (left item)

Date: 2009oct6
OS: Windows
Framework: MFC
Language: C/C++

Q.  A row is only selected when I click on the label (left item)
in my report mode list control (CListCtrl).  Is there a way to fix this?

A.  There are a number of ways to do this but the best is to enable LVS_EX_FULLROWSELECT like this:

void EnableNativeFullRowSelect(CListCtrl &list) { list.SetExtendedStyle(list.GetExtendedStyle() | LVS_EX_FULLROWSELECT); } // Example use BOOL CMyDlg::OnInitDialog() { CDialog::OnInitDialog(); EnableNativeFullRowSelect(m_MyList); // ... return TRUE; }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.