From 96f0accc818ad98abcb0d37e53d0a31e08ce4987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 14 Jul 2022 04:05:34 +0200 Subject: Minor formal changes. Height(DLVSIKEY) was incorrect. The argument to Height is supposed to be a boolean value, in this case false. It happened to work because DLVSIKEY is 0 (because Key is the 0th column in the data list view). --- c/listview.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 8e92ea1..b375454 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -11,12 +11,14 @@ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); ListView::ListView(HMENU hMenu, DWORD dwStyle) { + if (dwStyle & LVS_NOCOLUMNHEADER) + m_bHeader = 0; + m_hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, WC_LISTVIEW, TEXT(""), - dwStyle - |WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, + dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, 0, 0, 0, 0, g_hWnd, hMenu, GetModuleHandle(NULL), this ); @@ -34,6 +36,8 @@ ListView::ListView(HMENU hMenu, DWORD dwStyle) int ListView::Height(int bHeader) { + if (bHeader == -1) + bHeader = m_bHeader; int iCount = ListView_GetItemCount(m_hWnd); return iCount? Dpi(bHeader? 27: 4)+iCount*Dpi(19): 0; } @@ -89,7 +93,7 @@ ListView::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return CallWindowProc(m_prevProc, hWnd, uMsg, wParam, lParam); } -static LRESULT CALLBACK +LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -98,6 +102,6 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; } - ListView *lpThis = (ListView *)GetProp(hWnd, TEXT("this")); - return lpThis? lpThis->WndProc(hWnd, uMsg, wParam, lParam): FALSE; + ListView *lpLv = (ListView *)GetProp(hWnd, TEXT("this")); + return lpLv? lpLv->WndProc(hWnd, uMsg, wParam, lParam): FALSE; } -- cgit v1.2.3