Unfocus text editor when enter is pressed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-01 16:24:21 +00:00
parent d8c74d044b
commit 0d4884cbf3
3 changed files with 20 additions and 0 deletions

View File

@@ -155,6 +155,12 @@ public:
/** Handles events. Returns true if value in control was modified /** Handles events. Returns true if value in control was modified
(see wxPGProperty::OnEvent for more information). (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, virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
wxWindow* wnd_primary, wxEvent& event ) const = 0; wxWindow* wnd_primary, wxEvent& event ) const = 0;

View File

@@ -102,6 +102,12 @@ public:
/** /**
Handles events. Returns @true if value in control was modified Handles events. Returns @true if value in control was modified
(see wxPGProperty::OnEvent() for more information). (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, virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
wxWindow* wnd_primary, wxEvent& event ) const = 0; wxWindow* wnd_primary, wxEvent& event ) const = 0;

View File

@@ -3257,6 +3257,14 @@ void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
DoPropertyChanged(selected, selFlags); DoPropertyChanged(selected, selFlags);
EditorsValueWasNotModified(); EditorsValueWasNotModified();
//
// Regardless of editor type, unfocus editor on
// text-editing related enter press.
if ( event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER )
{
SetFocusOnCanvas();
}
} }
else else
{ {