Ensure that the new STC based text cell editor can be reset properly.
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 18 Sep 2009 15:29:51 +0000 (15:29 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 18 Sep 2009 15:29:51 +0000 (15:29 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@8041 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/frm/frmEditGrid.cpp

index 028cf1cae8274581f76b025bd617d11f5f012380..5709cab1c603f336be1173aab9c7e876f89f5159 100644 (file)
@@ -1503,10 +1503,13 @@ public:
     void BeginEdit(int row, int col, wxGrid* grid);
     bool EndEdit(int row, int col, wxGrid* grid);
     wxString GetValue() const;
+    virtual void Reset() { DoReset(m_startValue); }
 
 protected:
     void DoBeginEdit(const wxString& startValue);
     wxStyledTextCtrl *Text() const { return (wxStyledTextCtrl *)m_control; }
+    void DoReset(const wxString& startValue);
+
     wxString m_startValue;
 };
 
@@ -1561,6 +1564,13 @@ wxString sqlGridTextEditor::GetValue() const
 {
     return Text()->GetText();
 }
+
+void sqlGridTextEditor::DoReset(const wxString& startValue)
+{
+    Text()->SetText(startValue);
+    Text()->SetSelection(-1, -1);
+}
+
     
 class sqlGridNumericEditor : public wxGridCellTextEditor
 {