views:

47

answers:

2

I am trying to set the LVS_EX_FULLROWSELECT style on my grid list control as I want full row selection. However apparently it doesn't have any effect. Since I am using a number of other styles as well, I am wondering if LVS_EX_FULLROWSELECT has any compatibility issues with other styles. Anyone? Following are the styles I am setting.

Initially following styles are set on base list control class:

WS_CHILD|WS_BORDER|LVS_REPORT|LVS_SHOWSELALWAYS|LVS_SINGLESEL

Then I try to set additional styles in the derived grid list control class:

ListView_SetExtendedListViewStyleEx(sysId(), 0, LVS_EX_GRIDLINES | LVS_OWNERDATA | LVS_EX_FULLROWSELECT);
+3  A: 

You need to send the LVM_SETEXTENDEDLISTVIEWSTYLE message to the control and specify the LVS_EX_FULLROWSELECT extended style (source: MS Support).

Edit:

Check the example. There is

ListView_SetExtendedListViewStyle(m_hWnd, ListView_GetExtendedListViewStyle(m_hWnd), VS_EX_FULLROWSELECT);

Try using ListView_GetExtendedListViewStyle(sysId()) instead of 0. BTW - does this sysId() of yours really retrieve the window handle? The name sounds somewhat different.

Cheers.

AOI Karasu
Thank but this is what I am doing. The ListView_SetExtendedListViewStyleEx macro calls the LVM_SETEXTENDEDLISTVIEWSTYLE behind the scene. And I already have LVS_EX_FULLROWSELECT in the call. But it is not working, that's why I thought LVS_EX_FULLROWSELECT style may have compatibility issues with other styles I am using.
Jahanzeb Farooq
I've edited my answer to give you more detailed hint. Hope it helps.
AOI Karasu
It still doesn't work. It seems LVM_SETEXTENDEDLISTVIEWSTYLE is conflicting with some of the other styles I am setting. Yes sysId() does retrieve the window handle. Thanks anyway.
Jahanzeb Farooq
+1  A: 

The second parameter is a mask, so you need:

ListView_SetExtendedListViewStyleEx(m_hWnd, LVS_EX_GRIDLINES | LVS_OWNERDATA | LVS_EX_FULLROWSELECT, LVS_EX_GRIDLINES | LVS_OWNERDATA | LVS_EX_FULLROWSELECT);
Grammarian
Thanks. I tried but it didn't work. By the way isn't a 0 in second parameter means match everything. At least this is what documentation says.
Jahanzeb Farooq