Fix not refreshing wxListCtrl properly under macOS

Refresh() called from inside wxEVT_PAINT handler doesn't seem to have
any effect, so use CallAfter() to call it slightly later instead.

Closes #19139.
This commit is contained in:
Vadim Zeitlin 2021-08-06 21:01:18 +02:00
parent 233c487dfd
commit 36e9576d42

View File

@ -2058,7 +2058,19 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
}
if ( m_dirty )
RecalculatePositions( false );
{
// Calling Refresh() from inside OnPaint() doesn't work under macOS, so
// don't do it immediately...
RecalculatePositions(true /* no refresh */);
// ... but schedule it for later.
CallAfter(&wxWindow::Refresh, true, (const wxRect*)NULL);
// Don't bother redoing the relayout again the next time nor redrawing
// now, as we'll be refresh soon anyhow.
m_dirty = false;
return;
}
GetListCtrl()->PrepareDC( dc );