ListView Full Row Select

I had created a List View using the CreateWindowEx API, I had defined the needed styles and extended-styles to have the full row (item and sub-items) selected upon selecting any item, however, it is not working. Only the item is selected and highlighted without its sub-item.
Furthermore, I am not even able to select any of the sub-items (i don't know if this is applicable).

Below is a part of the code creating the list view control:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
HWND BsolListView::BsolLvCreate (BsolWindow * prntWnd_p) {
	.
	.
	.

	styleEx_v = LVS_EX_FULLROWSELECT 
		  | LVS_EX_DOUBLEBUFFER 
		  | LVS_EX_LABELTIP 
		  | LVS_EX_SUBITEMIMAGES 
		  | LVS_EX_TRANSPARENTBKGND
		;
	style_v = WS_CHILD | //WS_SIZEBOX | //WS_SYSMENU | WS_BORDER | WS_CAPTION | 
		  LVS_OWNERDATA 
		| LVS_EDITLABELS 
		| LVS_REPORT
//		| LVS_EX_GRIDLINES
		;

	this->LvWnd = CreateWindowEx(styleEx_v, WC_LISTVIEW, TEXT("List Of Values"),
				     style_v, X_v, Y_v, W_v, H_v, 
				     prntWnd_p->BsolGetWndHandle(), 
				     (HMENU)ctrlId_v, prntWnd_p->BsolGetInstance(), NULL);

	.
	.
	.
}


Besides, upon specifying the extended-style LVS_EX_TRANSPARENTBKGND, the appearance of the List View was changed from LTR to RTL. So the items started from the right instead of left.

Can any body justify this behavior and help to know what is missing in my code to have a full row selected?

Thanks in advance
Regards,
Try to set extended ListView style with ListView_SetExtendedListViewStyle macro

ListView_SetExtendedListViewStyle(this->LvWnd,styleEx_v);

I am not sure but I think the first parameter of CreateWindowEx sets only windw styles ( http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx )

ListView_SetExtendedListViewStyle http://msdn.microsoft.com/en-us/library/windows/desktop/bb775076(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/bb761165(v=vs.85).aspx
As Null said, you need to use the ListView_SetExtendedListViewStyle macro (or LVM_SETEXTENDEDLISTVIEWSTYLE message) to set extended List View styles.

If you pass LVS_EX_TRANSPARENTBKGND to CreateWindowEx via the first param, meant for extended windows styles, then this (from commctrl.h)

#define LVS_EX_TRANSPARENTBKGND 0x00400000

looks like this (from winuser.h)

#define WS_EX_LAYOUTRTL 0x00400000L

Andy

Last edited on
Null and Andy, thanks for you both valuable posts.

When I passed NULL in the CreateWindowEx API and then adjusted the extended style of the ListView as you mentioned, the items in List View was adjusted properly. However, the ListView is still flickering even though I am setting LVS_EX_DOUBLEBUFFER bit in the extended style.

Andy, now it is clear why the ListView turned to be RTL upon passing LVS_EX_TRANSPARENTBKGND in the first parameter of CreateWindowEx.

Actually I was confused in using CreateWindowEx because the controls (Buttons, Editboxes, ListView, ... ) are all considered to be as windows (as I understood while reading MSDN documentations). So I thought I can pass those extended styles for the control in the extended style parameter of CreateWindowEx API.

In addition to the flickering ListView control mentioned above, I have another issue related to sibling windows and controls when they overlaps but I will elaborate it in a new post.

Thanks again for your update.
Ahmad
Last edited on
Read again documentation of CreateWindowEx(), you have a list of all acceptable values in this page:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680(v=vs.85).aspx
Topic archived. No new replies allowed.