From: Vadim Zeitlin Date: Tue, 18 Jun 2002 15:23:54 +0000 (+0000) Subject: relayout the window after adding/removing the columns (fixes a SF bug I closed a... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/40c08808592b90f4d321e058efb3ffcb6ec90db8 relayout the window after adding/removing the columns (fixes a SF bug I closed a long time ago -- but forgot to commit the fix) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 38a9a92ce0..22cf70aa38 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4956,6 +4956,13 @@ void wxListCtrl::ClearAll() bool wxListCtrl::DeleteColumn( int col ) { m_mainWin->DeleteColumn( col ); + + // if we don't have the header any longer, we need to relayout the window + if ( !GetColumnCount() ) + { + ResizeReportView(FALSE /* no header */); + } + return TRUE; } @@ -5027,8 +5034,17 @@ long wxListCtrl::InsertItem( long index, const wxString &label, int imageIndex ) long wxListCtrl::InsertColumn( long col, wxListItem &item ) { - wxASSERT( m_headerWin ); + wxCHECK_MSG( m_headerWin, -1, _T("can't add column in non report mode") ); + m_mainWin->InsertColumn( col, item ); + + // if we hadn't had header before and have it now we need to relayout the + // window + if ( GetColumnCount() == 1 ) + { + ResizeReportView(TRUE /* have header */); + } + m_headerWin->Refresh(); return 0;