From 50fe1fadc27f39a604b10f469cac77a0a2335075 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 May 2014 22:12:47 +0000 Subject: [PATCH] Fix changing column order in wxGrid when some columns are hidden. Using negative column widths used for hidden columns when updating the column positions after dragging one of them to a new position totally broke their display. Fix this by ignoring the hidden columns. Closes #16110. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 1fed94b434..b324ac86c5 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -4455,7 +4455,11 @@ void wxGrid::RefreshAfterColPosChange() { int colID = GetColAt( colPos ); - colRight += m_colWidths[colID]; + // Ignore the currently hidden columns. + const int width = m_colWidths[colID]; + if ( width > 0 ) + colRight += width; + m_colRights[colID] = colRight; } }