diff --git a/docs/changes.txt b/docs/changes.txt index 6bf572afa6..8d1e8658eb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -596,6 +596,7 @@ wxMSW: - Fix initial text value of wxSpinCtrlDouble (Laurent Poujoulat). - Fix best size calculation for bitmaps with buttons (Artur Wieczorek). - Fix size of the icon returned from wxFSVolume::GetIcon() (troelsk). +- Fix autosize after expanding/collapsing items in wxDataViewCtrl (ciglesias). 3.0.2: (released 2014-10-06) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 95ef21a99b..57d0a4f4af 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -3208,6 +3208,11 @@ void wxDataViewMainWindow::Expand( unsigned int row ) ChangeCurrentRow(m_currentRow + rowAdjustment); m_count = -1; + + // 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()); @@ -3283,6 +3288,9 @@ void wxDataViewMainWindow::Collapse(unsigned int row) } m_count = -1; + + GetOwner()->InvalidateColBestWidths(); + UpdateDisplay(); SendExpanderEvent(wxEVT_DATAVIEW_ITEM_COLLAPSED,node->GetItem()); } @@ -5293,20 +5301,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