+void GridFrame::OnGridCustomTab(wxGridEvent& event)
+{
+ // just for testing, make the cursor move up and down instead of the usual
+ // left and right
+ if ( event.ShiftDown() )
+ {
+ if ( grid->GetGridCursorRow() > 0 )
+ grid->MoveCursorUp( false );
+ }
+ else
+ {
+ if ( grid->GetGridCursorRow() < grid->GetNumberRows() - 1 )
+ grid->MoveCursorDown( false );
+ }
+}
+
+void GridFrame::SetTabBehaviour(wxCommandEvent& event)
+{
+ // To make any built-in behaviour work, we need to disable the custom TAB
+ // handler, otherwise it would be overriding them.
+ grid->Disconnect(wxEVT_GRID_TABBING,
+ wxGridEventHandler(GridFrame::OnGridCustomTab));
+
+ grid->SetTabBehaviour(
+ static_cast<wxGrid::TabBehaviour>(event.GetId() - ID_TAB_STOP)
+ );
+}
+
+void GridFrame::SetTabCustomHandler(wxCommandEvent&)
+{
+ grid->Connect(wxEVT_GRID_TABBING,
+ wxGridEventHandler(GridFrame::OnGridCustomTab),
+ NULL, this);
+}
+
+