]> git.saurik.com Git - wxWidgets.git/commitdiff
don't call SetInsertionPointToEnd() on read-only combobox in wxGridCellChoiceEditor...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Jun 2008 00:19:44 +0000 (00:19 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Jun 2008 00:19:44 +0000 (00:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 27027a225209e954db2ed23b7c4138ec5648a9e1..65907544568016da9a08ec3f3c4ff3b40de423a4 100644 (file)
@@ -1598,19 +1598,7 @@ void wxGridCellChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
 
     m_startValue = grid->GetTable()->GetValue(row, col);
 
-    if (m_allowOthers)
-    {
-        Combo()->SetValue(m_startValue);
-        Combo()->SetInsertionPointEnd();
-    }
-    else // the combobox is read-only
-    {
-        // find the right position, or default to the first if not found
-        int pos = Combo()->FindString(m_startValue);
-        if (pos == wxNOT_FOUND)
-            pos = 0;
-        Combo()->SetSelection(pos);
-    }
+    Reset(); // this updates combo box to correspond to m_startValue
 
     Combo()->SetFocus();
 
@@ -1638,8 +1626,19 @@ bool wxGridCellChoiceEditor::EndEdit(int row, int col,
 
 void wxGridCellChoiceEditor::Reset()
 {
-    Combo()->SetValue(m_startValue);
-    Combo()->SetInsertionPointEnd();
+    if (m_allowOthers)
+    {
+        Combo()->SetValue(m_startValue);
+        Combo()->SetInsertionPointEnd();
+    }
+    else // the combobox is read-only
+    {
+        // find the right position, or default to the first if not found
+        int pos = Combo()->FindString(m_startValue);
+        if (pos == wxNOT_FOUND)
+            pos = 0;
+        Combo()->SetSelection(pos);
+    }
 }
 
 void wxGridCellChoiceEditor::SetParameters(const wxString& params)