Fix wrong wxGrid::RefreshBlock calling for an empty grid
There is no cells to select if the grid is empty (no rows or no columns). So check for the columns count in SelectRow and check for the rows count in SelectCol and call RefreshBlock only if it necessary. Fix https://trac.wxwidgets.org/ticket/18659 Fix https://trac.wxwidgets.org/ticket/18660
This commit is contained in:
@@ -257,7 +257,7 @@ void wxGridSelection::SelectRow(int row, const wxKeyboardState& kbd)
|
||||
}
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
if ( !m_grid->GetBatchCount() && m_grid->GetNumberCols() != 0 )
|
||||
{
|
||||
m_grid->RefreshBlock(row, 0, row, m_grid->GetNumberCols() - 1);
|
||||
}
|
||||
@@ -349,7 +349,7 @@ void wxGridSelection::SelectCol(int col, const wxKeyboardState& kbd)
|
||||
}
|
||||
|
||||
// Update View:
|
||||
if ( !m_grid->GetBatchCount() )
|
||||
if ( !m_grid->GetBatchCount() && m_grid->GetNumberRows() != 0 )
|
||||
{
|
||||
m_grid->RefreshBlock(0, col, m_grid->GetNumberRows() - 1, col);
|
||||
}
|
||||
|
Reference in New Issue
Block a user