]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grideditors.cpp
Don't forbid creating wxSplitterWindow with border style.
[wxWidgets.git] / src / generic / grideditors.cpp
index ef818831bbeb512de8f0c5dbe507fbf60f0f578d..57f01972b3471cac7304f289832989143d307532 100644 (file)
@@ -355,7 +355,7 @@ bool wxGridCellEditor::IsAcceptedKey(wxKeyEvent& event)
         return false;
 
 #if wxUSE_UNICODE
         return false;
 
 #if wxUSE_UNICODE
-    if ( event.GetUnicodeKey() == WXK_NONE )
+    if ( static_cast<int>(event.GetUnicodeKey()) == WXK_NONE )
         return false;
 #else
     if ( event.GetKeyCode() > WXK_START )
         return false;
 #else
     if ( event.GetKeyCode() > WXK_START )
@@ -547,8 +547,7 @@ void wxGridCellTextEditor::StartingKey(wxKeyEvent& event)
     // a valid character, so not a whole lot of testing needs to be done.
 
     wxTextCtrl* tc = Text();
     // a valid character, so not a whole lot of testing needs to be done.
 
     wxTextCtrl* tc = Text();
-    wxChar ch;
-    long pos;
+    int ch;
 
     bool isPrintable;
 
 
     bool isPrintable;
 
@@ -559,29 +558,28 @@ void wxGridCellTextEditor::StartingKey(wxKeyEvent& event)
     else
 #endif // wxUSE_UNICODE
     {
     else
 #endif // wxUSE_UNICODE
     {
-        ch = (wxChar)event.GetKeyCode();
+        ch = event.GetKeyCode();
         isPrintable = ch >= WXK_SPACE && ch < WXK_START;
     }
 
     switch (ch)
     {
         case WXK_DELETE:
         isPrintable = ch >= WXK_SPACE && ch < WXK_START;
     }
 
     switch (ch)
     {
         case WXK_DELETE:
-            // delete the character at the cursor
-            pos = tc->GetInsertionPoint();
-            if (pos < tc->GetLastPosition())
-                tc->Remove(pos, pos + 1);
+            // Delete the initial character when starting to edit with DELETE.
+            tc->Remove(0, 1);
             break;
 
         case WXK_BACK:
             break;
 
         case WXK_BACK:
-            // delete the character before the cursor
-            pos = tc->GetInsertionPoint();
-            if (pos > 0)
+            // Delete the last character when starting to edit with BACKSPACE.
+            {
+                const long pos = tc->GetLastPosition();
                 tc->Remove(pos - 1, pos);
                 tc->Remove(pos - 1, pos);
+            }
             break;
 
         default:
             if ( isPrintable )
             break;
 
         default:
             if ( isPrintable )
-                tc->WriteText(ch);
+                tc->WriteText(static_cast<wxChar>(ch));
             break;
     }
 }
             break;
     }
 }
@@ -1508,7 +1506,6 @@ void wxGridCellEnumEditor::BeginEdit(int row, int col, wxGrid* grid)
     }
 
     Combo()->SetSelection(m_index);
     }
 
     Combo()->SetSelection(m_index);
-    Combo()->SetInsertionPointEnd();
     Combo()->SetFocus();
 
 }
     Combo()->SetFocus();
 
 }