From e1fce68be6ae17e0164b2df07c79302f2b8853e6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 31 Jan 2020 16:22:49 +0100 Subject: [PATCH] Account for checkboxes when autosizing wxListCtrl first column Without this, the text of the first column was truncated when using checkboxes. Closes #18661. --- src/generic/listctrl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 8056238d6d..141531cc75 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -3307,6 +3307,13 @@ void wxListMainWindow::SetColumnWidth( int col, int width ) width = calculator.GetMaxWidth() + AUTOSIZE_COL_MARGIN; + if ( col == 0 && HasCheckBoxes() ) + { + // also account for the space needed by the checkbox + width += wxRendererNative::Get().GetCheckBoxSize(this).x + + 2*MARGIN_AROUND_CHECKBOX; + } + // expand the last column to fit the client size // only for AUTOSIZE_USEHEADER to mimic MSW behaviour if ( (width == wxLIST_AUTOSIZE_USEHEADER) && (col == GetColumnCount() - 1) )