]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't scroll the grid when starting a cell editor if it will already
authorRobin Dunn <robin@alldunn.com>
Tue, 23 May 2006 02:17:39 +0000 (02:17 +0000)
committerRobin Dunn <robin@alldunn.com>
Tue, 23 May 2006 02:17:39 +0000 (02:17 +0000)
fit in the viewable space.  The way it was always jumping around drove
me nuts!

Also, ensure that keys like HOME or END won't start the cell editor on
wxGTK2.

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

src/generic/grid.cpp

index 81140534de100c8c084fb3f4af86ddbbca9c71d3..a8378fb171976a55b47ccefaa74779585bae4a83 100644 (file)
@@ -570,6 +570,12 @@ bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
     int key = 0;
     bool keyOk = true;
 
+#ifdef __WXGTK20__
+    // If it's a F-Key or other special key then it shouldn't start the
+    // editor.
+    if (event.GetKeyCode() >= WXK_START)
+        return false;
+#endif
 #if wxUSE_UNICODE
     // if the unicode key code is not really a unicode character (it may
     // be a function key or etc., the platforms appear to always give us a
@@ -7957,24 +7963,12 @@ void wxGrid::ShowCellEditControl()
 
             editor->SetCellAttr( attr );
             editor->SetSize( rect );
-            editor->GetControl()->Move(
-                editor->GetControl()->GetPosition().x + nXMove,
-                editor->GetControl()->GetPosition().y );
+            if (nXMove != 0)
+                editor->GetControl()->Move(
+                    editor->GetControl()->GetPosition().x + nXMove,
+                    editor->GetControl()->GetPosition().y );
             editor->Show( true, attr );
 
-            int colXPos = 0;
-            for (int i = 0; i < m_currentCellCoords.GetCol(); i++)
-            {
-                colXPos += GetColSize( i );
-            }
-
-            int xUnit = 1, yUnit = 1;
-            GetScrollPixelsPerUnit( &xUnit, &yUnit );
-            if (m_currentCellCoords.GetCol() != 0)
-                Scroll( colXPos / xUnit - 1, GetScrollPos( wxVERTICAL ) );
-            else
-                Scroll( colXPos / xUnit, GetScrollPos( wxVERTICAL ) );
-
             // recalc dimensions in case we need to
             // expand the scrolled window to account for editor
             CalcDimensions();