Click to See Complete Forum and Search --> : CListCtrl - Full row selection


manjaly
June 21st, 1999, 11:26 PM
How to select a full row in a CListCtrl?
Thanks in advance.

Paul Burns
June 21st, 1999, 11:28 PM
DWORD dwStyleEx = pListCtrl->GetExtendedStyle();
dwStyleEx |= LVS_EX_FULLROWSELECT;
pListCtrl->SetExtendedStyle(dwStyleEx);

GEAK
June 22nd, 1999, 12:26 PM
That works fine if you're using VC6, but GetExtendedStyle and SetExtendedStyle weren't supported in previous incarnations of VC. This will do the same thing (plus add header drag-drop and gridlines) for a list control. If you're using a list view, run this in your OnCreate override and drop the "m_list." prefix to SendMessage (tested with VC5).

// Assuming CListCtrl m_list;
int nStyleEx = LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_list.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, nStyleEx, nStyleEx);

suri
June 22nd, 1999, 12:39 PM
is there an equivalent to these functions in vc++ 5.0

benny
June 24th, 1999, 11:54 PM
Hi,

Add this line it will work.
//m_List is your CListCtrl
m_List.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);

Regards,
Joel.