Unfocus text editor when enter is pressed
authorJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 1 Oct 2008 16:24:21 +0000 (16:24 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Wed, 1 Oct 2008 16:24:21 +0000 (16:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/propgrid/editors.h
interface/wx/propgrid/editors.h
src/propgrid/propgrid.cpp

index d07e7adf0d464055bb79761bae1f83010761d154..0d6ff4db6e568bbe19350fa053b2d38cb47ae2b3 100644 (file)
@@ -155,6 +155,12 @@ public:
 
     /** Handles events. Returns true if value in control was modified
         (see wxPGProperty::OnEvent for more information).
+
+        @remarks wxPropertyGrid will automatically unfocus the editor when
+                wxEVT_COMMAND_TEXT_ENTER is received and when it results in
+                property value being modified. This happens regardless of
+                editor type (ie. behavior is same for any wxTextCtrl and
+                wxComboBox based editor).
     */
     virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
         wxWindow* wnd_primary, wxEvent& event ) const = 0;
index 77ae7bf00594cb5ce67cef3cc5e813148478afeb..5e121e1432daccf906d62e87d23506c3f5cb08b5 100644 (file)
@@ -102,6 +102,12 @@ public:
     /**
         Handles events. Returns @true if value in control was modified
         (see wxPGProperty::OnEvent() for more information).
+
+        @remarks wxPropertyGrid will automatically unfocus the editor when
+                wxEVT_COMMAND_TEXT_ENTER is received and when it results in
+                property value being modified. This happens regardless of
+                editor type (ie. behavior is same for any wxTextCtrl and
+                wxComboBox based editor).
     */
     virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
         wxWindow* wnd_primary, wxEvent& event ) const = 0;
index 1e4850c31cce18683d2bc36ce38f9e5086df45b5..ad2faab46f8b12fd9ed5631b55f5471662fbc2d0 100644 (file)
@@ -3257,6 +3257,14 @@ void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
 
         DoPropertyChanged(selected, selFlags);
         EditorsValueWasNotModified();
+
+        //
+        // Regardless of editor type, unfocus editor on
+        // text-editing related enter press.
+        if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
+        {
+            SetFocusOnCanvas();
+        }
     }
     else
     {