From d9ca264808d89c680d7eb93edf29b2edea945f52 Mon Sep 17 00:00:00 2001 From: Michael Bedward Date: Mon, 5 Jun 2000 10:04:55 +0000 Subject: [PATCH] Modified wxGrid::SetCurrentCell() to fix problem under wxMSW where the grid was spending time drawing cells outside the visible area. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7529 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 93a57af281..d8582390c9 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5360,21 +5360,24 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) HideCellEditControl(); DisableCellEditControl(); - // Clear the old current cell highlight - wxRect r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); - - if ( !m_gridLinesEnabled ) + wxRect r; + if ( IsVisible( m_currentCellCoords ) ) { - r.x--; - r.y--; - r.width++; - r.height++; + r = BlockToDeviceRect(m_currentCellCoords, m_currentCellCoords); + CalcCellsExposed( r ); + + if ( !m_gridLinesEnabled ) + { + r.x--; + r.y--; + r.width++; + r.height++; + } + + // Otherwise refresh redraws the highlight! + m_currentCellCoords = coords; } - - // Otherwise refresh redraws the highlight! - m_currentCellCoords = coords; - - CalcCellsExposed( r ); + DrawGridCellArea(dc); DrawAllGridLines( dc, r ); }