Click to See Complete Forum and Search --> : How to select the entire row in a List View/ List ctrl.?


Jeevan Sunkersett
April 22nd, 1999, 05:13 AM
Hi,

I am sending this as I cannot find my earlier post on the same issue.
It is how to select the complete row and not the first column, in a List View/ List ctrl.

I know that it is done by List View macro which does nothing but do a SendMessage to the List ctrl.

But the question is what message ? LVN...

regards

Jeevan S

SKB
April 22nd, 1999, 10:09 AM
In VC++6 you can use LVS_EX_FULLROWSELECT in the ExtendedStyle of the ListCtrl.

If you are using version 5 then you can find the information under listctrl in the codeguru sections, under listview.

CListCtrl &ListCtrl = GetListCtrl();
DWORD dwExStyles = ListCtrl.GetExtendedStyle();
ListCtrl.SetExtendedStyle(dwExStyles | LVS_EX_FULLROWSELECT |
LVS_EX_GRIDLINES |
LVS_EX_HEADERDRAGDROP |
LVS_EX_ONECLICKACTIVATE |
LVS_EX_CHECKBOXES |
LVS_EX_FLATSB|
LVS_EX_TRACKSELECT);

yash
April 22nd, 1999, 03:29 PM
in OnInitDialog have this.

// lects the Full Row in the List Control

DWORD dwStyle = m_MyListCtrl.SendMessage (LVM_GETEXTENDEDLISTVIEWSTYLE,0,0);
dwStyle |= LVS_EX_FULLROWSELECT;
m_MyListCtrl.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);


Hope this helps U.
Good Luck.
Yash.

Jeevan Sunkersett
April 23rd, 1999, 05:42 AM
Thanks,

However I cannot locate the header file, which contains the values for the constant's
LVS_EX_FULLROWSELECT, LVS_EX_GRIDLINES. LVS_EX_HEADERDRAGDROP etc...

Maybe I will have to re-install VC, which may take time, as I can only do so in my free time.

Pls can you email me the values or the header file.

thanks in advance and regards

Jeevan S (sjeevan@iname.com)

SKB
April 23rd, 1999, 05:49 AM
The following defines have been taken from COMCTRL.H, which can be found in the following directory
Microsoft Visual Studio\VC98\INCLUDE

#define LVS_EX_GRIDLINES 0x00000001
#define LVS_EX_SUBITEMIMAGES 0x00000002
#define LVS_EX_CHECKBOXES 0x00000004
#define LVS_EX_TRACKSELECT 0x00000008
#define LVS_EX_HEADERDRAGDROP 0x00000010
#define LVS_EX_FULLROWSELECT 0x00000020 // applies to report mode only
#define LVS_EX_ONECLICKACTIVATE 0x00000040
#define LVS_EX_TWOCLICKACTIVATE 0x00000080