diff --git a/ZRCola/zrcolachrgrid.cpp b/ZRCola/zrcolachrgrid.cpp index 78bd8e8..fb4dd66 100644 --- a/ZRCola/zrcolachrgrid.cpp +++ b/ZRCola/zrcolachrgrid.cpp @@ -26,6 +26,7 @@ BEGIN_EVENT_TABLE(wxZRColaCharGrid, wxGrid) EVT_SIZE(wxZRColaCharGrid::OnSize) + EVT_KEY_DOWN(wxZRColaCharGrid::OnKeyDown) END_EVENT_TABLE() @@ -106,3 +107,21 @@ void wxZRColaCharGrid::OnSize(wxSizeEvent& event) EndBatch(); m_isResizing = false; } + + +void wxZRColaCharGrid::OnKeyDown(wxKeyEvent& event) +{ + wxWindow *parentWnd; + + if (event.GetKeyCode() == WXK_TAB && (parentWnd = GetParent()) != NULL) { + wxNavigationKeyEvent eventNav; + eventNav.SetDirection(!event.ShiftDown()); + eventNav.SetWindowChange(event.ControlDown()); + eventNav.SetEventObject(this); + + if (parentWnd->HandleWindowEvent(eventNav)) + return; + } + + event.Skip(); +} diff --git a/ZRCola/zrcolachrgrid.h b/ZRCola/zrcolachrgrid.h index 805d15d..5d2b6ab 100644 --- a/ZRCola/zrcolachrgrid.h +++ b/ZRCola/zrcolachrgrid.h @@ -54,6 +54,7 @@ public: protected: void OnSize(wxSizeEvent& event); + void OnKeyDown(wxKeyEvent& event); DECLARE_EVENT_TABLE() protected: