diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index c34e94afec..4aa428b9f6 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1311,15 +1311,6 @@ public: wxRect BlockToDeviceRect( const wxGridCellCoords & topLeft, const wxGridCellCoords & bottomRight ); - // This function returns the rectangle that encloses the selected cells - // in device coords and clipped to the client size of the grid window. - // - wxRect SelectionToDeviceRect() - { - return BlockToDeviceRect( m_selectingTopLeft, - m_selectingBottomRight ); - } - // Access or update the selection fore/back colours wxColour GetSelectionBackground() const { return m_selectionBackground; } diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index b05825ec99..de2436cbc0 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -5358,6 +5358,9 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) return; } + wxClientDC dc(m_gridWin); + PrepareDC(dc); + if ( m_currentCellCoords != wxGridNoCellCoords ) { HideCellEditControl(); @@ -5377,28 +5380,16 @@ void wxGrid::SetCurrentCell( const wxGridCellCoords& coords ) // Otherwise refresh redraws the highlight! m_currentCellCoords = coords; - m_gridWin->Refresh( FALSE, &r ); + CalcCellsExposed( r ); + DrawGridCellArea(dc); + DrawAllGridLines( dc, r ); } m_currentCellCoords = coords; - wxClientDC dc(m_gridWin); - PrepareDC(dc); - wxGridCellAttr* attr = GetCellAttr(coords); DrawCellHighlight(dc, attr); attr->DecRef(); - -#if 0 - // SN: For my extended selection code, automatic - // deselection is definitely not a good idea. - if ( IsSelection() ) - { - wxRect r( SelectionToDeviceRect() ); - ClearSelection(); - if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r ); - } -#endif }