Don't update wxDataViewColumn after it was resized interactively
Previously, the column was updated, i.e. wxHeaderCtrl::UpdateColumn() was called, after the column width was changed interactively by the user. This was unnecessary and actually harmful as it resulted in recursion and display corruption. Stop doing this by adding yet another width-related function to the generic wxDataViewColumn called WXOnResize(), which just updates the main window display, but doesn't update the header at all, and calling it instead of SetWidth(), which does both, when the column is resized. Closes #18245.
This commit is contained in:
@@ -204,6 +204,14 @@ int wxDataViewColumn::GetWidth() const
|
||||
}
|
||||
}
|
||||
|
||||
void wxDataViewColumn::WXOnResize(int width)
|
||||
{
|
||||
m_width =
|
||||
m_manuallySetWidth = width;
|
||||
|
||||
m_owner->OnColumnResized();
|
||||
}
|
||||
|
||||
void wxDataViewColumn::UpdateDisplay()
|
||||
{
|
||||
if (m_owner)
|
||||
@@ -401,7 +409,7 @@ private:
|
||||
wxDataViewCtrl * const owner = GetOwner();
|
||||
|
||||
const unsigned col = event.GetColumn();
|
||||
owner->GetColumn(col)->SetWidth(event.GetWidth());
|
||||
owner->GetColumn(col)->WXOnResize(event.GetWidth());
|
||||
}
|
||||
|
||||
void OnEndReorder(wxHeaderCtrlEvent& event)
|
||||
@@ -5454,6 +5462,11 @@ bool wxDataViewCtrl::InsertColumn( unsigned int pos, wxDataViewColumn *col )
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDataViewCtrl::OnColumnResized()
|
||||
{
|
||||
m_clientArea->UpdateDisplay();
|
||||
}
|
||||
|
||||
void wxDataViewCtrl::OnColumnWidthChange(unsigned int idx)
|
||||
{
|
||||
InvalidateColBestWidth(idx);
|
||||
|
Reference in New Issue
Block a user