From: Michael Bedward Date: Tue, 7 Mar 2000 10:07:36 +0000 (+0000) Subject: Modified +arrow key behaviour so that the starting cell is X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cb9fb5bb00db9f4be77ec3bf9958982a3a9e17c2 Modified +arrow key behaviour so that the starting cell is included in the selection git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6497 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 7549412026..fccc79f085 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -6131,6 +6131,10 @@ bool wxGrid::MoveCursorUp( bool expandSelection ) if ( m_currentCellCoords != wxGridNoCellCoords && m_currentCellCoords.GetRow() > 0 ) { + if ( expandSelection ) + m_selection->SelectCell( m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol() ); + MakeCellVisible( m_currentCellCoords.GetRow() - 1, m_currentCellCoords.GetCol() ); @@ -6149,11 +6153,13 @@ bool wxGrid::MoveCursorUp( bool expandSelection ) bool wxGrid::MoveCursorDown( bool expandSelection ) { - // TODO: allow for scrolling - // if ( m_currentCellCoords != wxGridNoCellCoords && m_currentCellCoords.GetRow() < m_numRows-1 ) { + if ( expandSelection ) + m_selection->SelectCell( m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol() ); + MakeCellVisible( m_currentCellCoords.GetRow() + 1, m_currentCellCoords.GetCol() ); @@ -6175,6 +6181,10 @@ bool wxGrid::MoveCursorLeft( bool expandSelection ) if ( m_currentCellCoords != wxGridNoCellCoords && m_currentCellCoords.GetCol() > 0 ) { + if ( expandSelection ) + m_selection->SelectCell( m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol() ); + MakeCellVisible( m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol() - 1 ); @@ -6196,6 +6206,10 @@ bool wxGrid::MoveCursorRight( bool expandSelection ) if ( m_currentCellCoords != wxGridNoCellCoords && m_currentCellCoords.GetCol() < m_numCols - 1 ) { + if ( expandSelection ) + m_selection->SelectCell( m_currentCellCoords.GetRow(), + m_currentCellCoords.GetCol() ); + MakeCellVisible( m_currentCellCoords.GetRow(), m_currentCellCoords.GetCol() + 1 );