diff --git a/src/osx/cocoa/listbox.mm b/src/osx/cocoa/listbox.mm index ea02dee856..f2e97a33da 100644 --- a/src/osx/cocoa/listbox.mm +++ b/src/osx/cocoa/listbox.mm @@ -473,7 +473,9 @@ wxListWidgetColumn* wxListWidgetCocoaImpl::InsertCheckColumn( unsigned pos , con void wxListWidgetCocoaImpl::AdaptColumnWidth ( int w ) { - NSTableColumn *col = [[m_tableView tableColumns] objectAtIndex:0]; + // Note that the table can have more than one column as it's also used by + // wxCheckListBox, but the column containing the text is always the last one. + NSTableColumn *col = [[m_tableView tableColumns] lastObject]; [col setWidth:w]; m_maxWidth = w; } @@ -488,7 +490,7 @@ void wxListWidgetCocoaImpl::ListInsert( unsigned int n ) if ( m_autoSize ) { - NSCell *cell = [m_tableView preparedCellAtColumn:0 row:n]; + NSCell *cell = [m_tableView preparedCellAtColumn:[m_tableView numberOfColumns]-1 row:n]; NSSize size = [cell cellSize]; int width = (int) ceil(size.width);