Added page up and page down key support.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
21802234df
commit
66242c8007
@ -475,6 +475,8 @@ class wxGrid : public wxPanel
|
||||
bool MoveCursorDown();
|
||||
bool MoveCursorLeft();
|
||||
bool MoveCursorRight();
|
||||
bool MovePageDown();
|
||||
bool MovePageUp();
|
||||
bool MoveCursorUpBlock();
|
||||
bool MoveCursorDownBlock();
|
||||
bool MoveCursorLeftBlock();
|
||||
|
@ -1860,6 +1860,14 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev )
|
||||
}
|
||||
break;
|
||||
|
||||
case WXK_PRIOR:
|
||||
MovePageUp();
|
||||
break;
|
||||
|
||||
case WXK_NEXT:
|
||||
MovePageDown();
|
||||
break;
|
||||
|
||||
default:
|
||||
// now try the cell edit control
|
||||
//
|
||||
@ -2363,6 +2371,54 @@ bool wxGrid::MoveCursorRight()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxGrid::MovePageUp()
|
||||
{
|
||||
if ( m_currentCellCoords != wxGridNoCellCoords &&
|
||||
m_scrollPosY > 0 )
|
||||
{
|
||||
int row = m_currentCellCoords.GetRow();
|
||||
int y = m_rowBottoms[ row ] - m_rowHeights[ row ];
|
||||
while ( row > 0 )
|
||||
{
|
||||
if ( y + m_rowHeights[row-1] > m_bottom ) break;
|
||||
y += m_rowHeights[ --row ];
|
||||
}
|
||||
SetVerticalScrollPos( row );
|
||||
|
||||
SelectCell( row, m_currentCellCoords.GetCol() );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxGrid::MovePageDown()
|
||||
{
|
||||
if ( m_currentCellCoords != wxGridNoCellCoords &&
|
||||
m_scrollPosY + m_wholeRowsVisible < m_numRows )
|
||||
{
|
||||
if ( m_wholeRowsVisible > 0 )
|
||||
{
|
||||
SetVerticalScrollPos( m_scrollPosY + m_wholeRowsVisible );
|
||||
}
|
||||
else if ( m_scrollPosY < m_numRows - 1 )
|
||||
{
|
||||
SetVerticalScrollPos( m_scrollPosY + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// m_scrollPosY will have been updated
|
||||
//
|
||||
SelectCell( m_scrollPosY, m_currentCellCoords.GetCol() );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxGrid::MoveCursorUpBlock()
|
||||
{
|
||||
if ( m_table &&
|
||||
|
Loading…
Reference in New Issue
Block a user