Do nothing in wxGrid::SetCellValue() if value doesn't change
This is a minor optimization and can significantly reduce flicker in a not uncommon case when SetCellValue() is used to refresh all or many of the grid cells if only few of them actually change. See #9717. Closes https://github.com/wxWidgets/wxWidgets/pull/1276
This commit is contained in:
committed by
Vadim Zeitlin
parent
3d45374200
commit
a9a0305758
@@ -8818,6 +8818,12 @@ wxPen& wxGrid::GetDividerPen() const
|
|||||||
|
|
||||||
void wxGrid::SetCellValue( int row, int col, const wxString& s )
|
void wxGrid::SetCellValue( int row, int col, const wxString& s )
|
||||||
{
|
{
|
||||||
|
if ( s == GetCellValue(row, col) )
|
||||||
|
{
|
||||||
|
// Avoid flicker by not doing anything in this case.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( m_table )
|
if ( m_table )
|
||||||
{
|
{
|
||||||
m_table->SetValue( row, col, s );
|
m_table->SetValue( row, col, s );
|
||||||
|
Reference in New Issue
Block a user