diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index b5b1893ce4..96bd168463 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5565,6 +5565,8 @@ bool wxPropertyGrid::IsEditorFocused() const void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused ) { unsigned int oldFlags = m_iFlags; + bool wasEditorFocused = false; + wxWindow* wndEditor = m_wndEditor; m_iFlags &= ~(wxPG_FL_FOCUSED); @@ -5573,9 +5575,13 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused ) // This must be one of nextFocus' parents. while ( parent ) { + if ( parent == wndEditor ) + { + wasEditorFocused = true; + } // Use m_eventObject, which is either wxPropertyGrid or // wxPropertyGridManager, as appropriate. - if ( parent == m_eventObject ) + else if ( parent == m_eventObject ) { m_iFlags |= wxPG_FL_FOCUSED; break; @@ -5583,6 +5589,17 @@ void wxPropertyGrid::HandleFocusChange( wxWindow* newFocused ) parent = parent->GetParent(); } + // Notify editor control when it receives a focus + if ( wasEditorFocused && m_curFocused != newFocused ) + { + wxPGProperty* p = GetSelection(); + if ( p ) + { + const wxPGEditor* editor = p->GetEditorClass(); + editor->OnFocus(p, GetEditorControl()); + } + } + m_curFocused = newFocused; if ( (m_iFlags & wxPG_FL_FOCUSED) !=