Remove wxTreeListCtrl special first column resizing logic
Trying to give all the remaining space after allocating enough to the other columns to the first one doesn't work well with wxDataViewCtrl, which tries to do the same thing, but with the last column, so we actually get some strange mix of behaviours, with both the first and last columns changing size after the control itself is resized. Stop fighting with wxDataViewCtrl and just let it to its own thing. Closes #17476.
This commit is contained in:
committed by
Vadim Zeitlin
parent
008e8fcb21
commit
c6de521959
@@ -1455,28 +1455,6 @@ void wxTreeListCtrl::OnSize(wxSizeEvent& event)
|
||||
view->Refresh();
|
||||
view->Update();
|
||||
#endif // wxHAS_GENERIC_DATAVIEWCTRL
|
||||
|
||||
// Resize the first column to take the remaining available space.
|
||||
const unsigned numColumns = GetColumnCount();
|
||||
if ( !numColumns )
|
||||
return;
|
||||
|
||||
// There is a bug in generic wxDataViewCtrl: if the column width sums
|
||||
// up to the total size, horizontal scrollbar (unnecessarily) appears,
|
||||
// so subtract a bit to ensure this doesn't happen.
|
||||
int remainingWidth = rect.width - 5;
|
||||
for ( unsigned n = 1; n < GetColumnCount(); n++ )
|
||||
{
|
||||
remainingWidth -= GetColumnWidth(n);
|
||||
if ( remainingWidth <= 0 )
|
||||
{
|
||||
// There is not enough space, as we're not going to give the
|
||||
// first column negative width anyhow, just don't do anything.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SetColumnWidth(0, remainingWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user