]> git.saurik.com Git - wxWidgets.git/commitdiff
Make Home and End keys work as expected in wxGrid.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Jul 2010 22:50:18 +0000 (22:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 12 Jul 2010 22:50:18 +0000 (22:50 +0000)
Go to the first/last cell of the current row when they're pressed instead of
starting the editor.

Closes #12222.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64917 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 798ffce16eca3e36e785be885c1ba693aea83445..106a57a06e40e587b786e13f85f1ce4cd1b4d578 100644 (file)
@@ -4669,25 +4669,15 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
                 break;
 
             case WXK_HOME:
-                if ( event.ControlDown() )
-                {
-                    GoToCell(0, 0);
-                }
-                else
-                {
-                    event.Skip();
-                }
+                GoToCell(event.ControlDown() ? 0
+                                             : m_currentCellCoords.GetRow(),
+                         0);
                 break;
 
             case WXK_END:
-                if ( event.ControlDown() )
-                {
-                    GoToCell(m_numRows - 1, m_numCols - 1);
-                }
-                else
-                {
-                    event.Skip();
-                }
+                GoToCell(event.ControlDown() ? m_numRows - 1
+                                             : m_currentCellCoords.GetRow(),
+                         m_numCols - 1);
                 break;
 
             case WXK_PAGEUP: