From 4bfd0ed55289f57f549fad4d5b8a94aae133b3c4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Mon, 8 Dec 2008 13:25:09 +0000 Subject: [PATCH] don't access inexistent column in wxDataViewTreeCtrl::OnSize() (this bug also probably explains why this code doesn't actually work: size event is generated before we have any columns) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/datavcmn.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index 26d568cd34..34e2123b6c 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -1887,10 +1887,12 @@ void wxDataViewTreeCtrl::OnCollapsed( wxDataViewEvent &event ) void wxDataViewTreeCtrl::OnSize( wxSizeEvent &event ) { #if defined(wxUSE_GENERICDATAVIEWCTRL) - wxSize size = GetClientSize(); - wxDataViewColumn *col = GetColumn( 0 ); - if (col) - col->SetWidth( size.x ); + // automatically resize our only column to take the entire control width + if ( GetColumnCount() ) + { + wxSize size = GetClientSize(); + GetColumn(0)->SetWidth(size.x); + } #endif event.Skip( true ); } -- 2.47.2