Implement wxGrid cells selection for Home and End keys
Select cells if Shift is pressed when handling Home and End keys
This commit is contained in:
committed by
Vadim Zeitlin
parent
677b9d21ea
commit
6e6eb799c8
@@ -5567,7 +5567,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
if ( m_currentCellCoords == wxGridNoCellCoords )
|
||||
break;
|
||||
|
||||
int row = m_currentCellCoords.GetRow();
|
||||
const bool useSelectedBlockCorner =
|
||||
event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords;
|
||||
int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow()
|
||||
: m_currentCellCoords.GetRow();
|
||||
if ( event.ControlDown() )
|
||||
{
|
||||
row = 0;
|
||||
@@ -5588,8 +5591,17 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
break;
|
||||
}
|
||||
|
||||
ClearSelection();
|
||||
GoToCell(row, GetColAt(col));
|
||||
if ( event.ShiftDown() )
|
||||
{
|
||||
UpdateBlockBeingSelected(m_currentCellCoords,
|
||||
wxGridCellCoords(row, col));
|
||||
MakeCellVisible(row, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearSelection();
|
||||
GoToCell(row, GetColAt(col));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -5598,7 +5610,10 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
if ( m_currentCellCoords == wxGridNoCellCoords )
|
||||
break;
|
||||
|
||||
int row = m_currentCellCoords.GetRow();
|
||||
const bool useSelectedBlockCorner =
|
||||
event.ShiftDown() && m_selectedBlockCorner != wxGridNoCellCoords;
|
||||
int row = useSelectedBlockCorner ? m_selectedBlockCorner.GetRow()
|
||||
: m_currentCellCoords.GetRow();
|
||||
if ( event.ControlDown() )
|
||||
{
|
||||
row = m_numRows - 1;
|
||||
@@ -5619,8 +5634,17 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
|
||||
break;
|
||||
}
|
||||
|
||||
ClearSelection();
|
||||
GoToCell(row, GetColAt(col));
|
||||
if ( event.ShiftDown() )
|
||||
{
|
||||
UpdateBlockBeingSelected(m_currentCellCoords,
|
||||
wxGridCellCoords(row, col));
|
||||
MakeCellVisible(row, col);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearSelection();
|
||||
GoToCell(row, GetColAt(col));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user