From 79664972a38be441554806624ae40b0a9977729c Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 23 May 2016 18:59:12 +0200 Subject: [PATCH] Grid navigation to previous/next row using left and right arrow keys added --- ZRCola/zrcolachrgrid.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ZRCola/zrcolachrgrid.cpp b/ZRCola/zrcolachrgrid.cpp index 14132d1..5a46f72 100644 --- a/ZRCola/zrcolachrgrid.cpp +++ b/ZRCola/zrcolachrgrid.cpp @@ -159,7 +159,8 @@ void wxZRColaCharGrid::OnKeyDown(wxKeyEvent& event) { wxWindow *parentWnd; - if (event.GetKeyCode() == WXK_TAB && (parentWnd = GetParent()) != NULL) { + int key_code = event.GetKeyCode(); + if (key_code == WXK_TAB && (parentWnd = GetParent()) != NULL) { wxNavigationKeyEvent eventNav; eventNav.SetDirection(!event.ShiftDown()); eventNav.SetWindowChange(event.ControlDown()); @@ -167,6 +168,14 @@ void wxZRColaCharGrid::OnKeyDown(wxKeyEvent& event) if (parentWnd->HandleWindowEvent(eventNav)) return; + } else if (key_code == WXK_LEFT && m_currentCellCoords.GetCol() == 0 && m_currentCellCoords.GetRow()) { + GoToCell(m_currentCellCoords.GetRow() - 1, m_numCols - 1); + event.StopPropagation(); + return; + } else if (key_code == WXK_RIGHT && m_currentCellCoords.GetCol() == m_numCols - 1 && m_currentCellCoords.GetRow() < m_numRows - 1) { + GoToCell(m_currentCellCoords.GetRow() + 1, 0); + event.StopPropagation(); + return; } event.Skip();