From 3db29244e5e888ee2dd27f719cde31cf6dc6f321 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 22 Dec 2014 01:31:26 +0000 Subject: [PATCH] Don't try setting width before column is added to wxOSX wxDVC. This is not going to work anyhow and the width will be really set later, when InsertColumn() is called. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/dataview.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index e9ba27f366..ba62b1749b 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -3299,16 +3299,20 @@ void wxDataViewColumn::SetWidth(int width) { m_width = width; + if ( !GetOwner() ) + { + // can't set the real width yet + return; + } + switch ( width ) { case wxCOL_WIDTH_AUTOSIZE: - if ( GetOwner() ) { wxCocoaDataViewControl *peer = static_cast(GetOwner()->GetPeer()); peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this)); break; } - // fall through if not yet settable case wxCOL_WIDTH_DEFAULT: width = wxDVC_DEFAULT_WIDTH;