From 68232dec2b663046311cf41b82cfb5df194b6cf2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Dec 2014 22:19:04 +0000 Subject: [PATCH] Don't keep out of date column widths in generic wxDataViewCtrl. The cached widths need to be invalidated whenever an item is expanded or collapsed, whether it's done programmatically (which was already handled) or interactively by the user (which wasn't). Closes #16678. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 5be1656e61..40d635034e 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3153,6 +3153,11 @@ void wxDataViewMainWindow::Expand( unsigned int row ) if ( m_count != -1 ) m_count += countNewRows; + + // Expanding this item means the previously cached column widths could + // have become invalid as new items are now visible. + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); // Send the expanded event SendExpanderEvent(wxEVT_DATAVIEW_ITEM_EXPANDED,node->GetItem()); @@ -3201,6 +3206,9 @@ void wxDataViewMainWindow::Collapse(unsigned int row) if ( m_count != -1 ) m_count -= countDeletedRows; + + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); SendExpanderEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,node->GetItem()); } @@ -5331,20 +5339,14 @@ void wxDataViewCtrl::Expand( const wxDataViewItem & item ) int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Expand(row); - InvalidateColBestWidths(); - } } void wxDataViewCtrl::Collapse( const wxDataViewItem & item ) { int row = m_clientArea->GetRowByItem( item ); if (row != -1) - { m_clientArea->Collapse(row); - InvalidateColBestWidths(); - } } bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const