listview fix so that columns autosize correctly
This commit is contained in:
parent
e04fcf3527
commit
ce0320e2ad
@ -170,6 +170,8 @@ void OBS::AddSourceItem(LPWSTR name, bool checked, UINT index)
|
||||
|
||||
ListView_InsertItem(hwndSources, &lvI);
|
||||
ListView_SetCheckState(hwndSources, index, checked);
|
||||
ListView_SetColumnWidth(hwndSources, 0, LVSCW_AUTOSIZE_USEHEADER);
|
||||
ListView_SetColumnWidth(hwndSources, 1, LVSCW_AUTOSIZE_USEHEADER);
|
||||
}
|
||||
|
||||
bool OBS::SetScene(CTSTR lpScene)
|
||||
|
@ -708,7 +708,7 @@ OBS::OBS()
|
||||
SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)OBS::ListboxHook);
|
||||
|
||||
//-----------------------------------------------------
|
||||
// elements listbox
|
||||
// elements listview
|
||||
|
||||
hwndTemp = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, NULL,
|
||||
WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|WS_CLIPSIBLINGS|LVS_REPORT|LVS_NOCOLUMNHEADER|
|
||||
@ -720,11 +720,13 @@ OBS::OBS()
|
||||
|
||||
//add single column needed for report style
|
||||
LVCOLUMN column;
|
||||
column.mask = LVCF_TEXT | LVCF_WIDTH;
|
||||
column.mask = LVCF_TEXT;
|
||||
column.fmt = LVCFMT_FIXED_WIDTH;
|
||||
column.cx = listControlWidth - controlPadding * 3 ;
|
||||
column.cx = 0;
|
||||
column.pszText = TEXT("");
|
||||
|
||||
ListView_InsertColumn(hwndTemp, 0, &column);
|
||||
ListView_InsertColumn(hwndTemp, 1, &column);
|
||||
|
||||
listviewProc = (WNDPROC)GetWindowLongPtr(hwndTemp, GWLP_WNDPROC);
|
||||
SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)OBS::ListboxHook);
|
||||
|
@ -803,6 +803,11 @@ LRESULT CALLBACK OBS::ListboxHook(HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
}
|
||||
|
||||
|
||||
if(message == WM_SIZE && id == ID_SOURCES)
|
||||
{
|
||||
ListView_SetColumnWidth(hwnd, 0, LVSCW_AUTOSIZE_USEHEADER);
|
||||
ListView_SetColumnWidth(hwnd, 1, LVSCW_AUTOSIZE_USEHEADER);
|
||||
}
|
||||
if(id == ID_SOURCES)
|
||||
{
|
||||
return CallWindowProc(listviewProc, hwnd, message, wParam, lParam);
|
||||
|
Loading…
x
Reference in New Issue
Block a user