Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange effect when creating a ListView

Tags:

c

listview

winapi

I have noticed a strange effect when I create a Listview.

When I create a ListView without also creating a Button, the selected item in the ListView have a dotted border. However, when I also create a Button, the ListView selected item don't have a dotted border anymore. This only happens when I have a manifest file that enables common controls 6:

enter image description here

This is the code I used to create the Window and ListView and Button:

// Create Window
HWND hWnd = CreateWindowEx(0, "WinClass", "My Window", WS_OVERLAPPEDWINDOW, 261, 172, 394, 284, NULL, NULL, hInstance, NULL);

// Create ListView
HWND hListView = CreateWindowEx(0, WC_LISTVIEW, "", WS_CHILD | LVS_REPORT | WS_VISIBLE, 0, 0, 232, 190, hWnd, 0, GetModuleHandle(NULL), NULL);

// Create Button
HWND hButtonRefresh = CreateWindowEx(NULL, "BUTTON", "OK", WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 10, 200, 110, 25, hWnd, NULL, GetModuleHandle(NULL), NULL);

Note: I don't have a problem with this effect, I just want to understand why it is happening!

like image 213
paul Avatar asked Nov 09 '22 10:11

paul


1 Answers

It's just because the button has the focus and the list view lost it, click on the list view and the dots should reappear.

like image 157
Iharob Al Asimi Avatar answered Nov 15 '22 13:11

Iharob Al Asimi