positions correctly on initialization now

This commit is contained in:
freedom7341
2023-10-11 12:18:18 -06:00
parent 67e821a33c
commit 36a6d1a888

View File

@@ -92,6 +92,7 @@ HWND CreateGroup(_In_ PGROUP pg)
HICON hIconTemp = NULL;
HWND hWndGroup = NULL;
HWND hWndListView = NULL;
RECT rcGroupWindow = { 0 };
LVCOLUMN lvc = { 0 };
if (pg == NULL)
@@ -145,6 +146,9 @@ HWND CreateGroup(_In_ PGROUP pg)
DestroyIcon(hIconTemp);
}
// get the group window rect
GetClientRect(hWndGroup, &rcGroupWindow);
// Create the group window ListView control
if ((hWndListView = CreateWindowEx(WS_EX_LEFT, WC_LISTVIEW, TEXT("ListView"),
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
@@ -154,6 +158,12 @@ HWND CreateGroup(_In_ PGROUP pg)
NULL)) == NULL)
return NULL;
// resize it to fit the window
SetWindowPos(hWndListView, NULL,
rcGroupWindow.left, rcGroupWindow.top,
rcGroupWindow.right - rcGroupWindow.left,
rcGroupWindow.bottom - rcGroupWindow.top, SWP_NOZORDER);
// create a ListView name column
lvc.mask = LVCF_FMT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
@@ -402,11 +412,10 @@ LRESULT CALLBACK GroupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
break;
// resize it to fit the window
if ((rcGroupWindow.left != rcGroupWindow.right) && (rcGroupWindow.top != rcGroupWindow.bottom))
SetWindowPos(hWndListView, NULL,
rcGroupWindow.left, rcGroupWindow.top,
rcGroupWindow.right - rcGroupWindow.left,
rcGroupWindow.bottom - rcGroupWindow.top, SWP_NOZORDER);
SetWindowPos(hWndListView, NULL,
rcGroupWindow.left, rcGroupWindow.top,
rcGroupWindow.right - rcGroupWindow.left,
rcGroupWindow.bottom - rcGroupWindow.top, SWP_NOZORDER);
break;
}