]> git.saurik.com Git - wxWidgets.git/commitdiff
Properly notify active editor control when it receives the focus.
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 19 Dec 2009 12:08:00 +0000 (12:08 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sat, 19 Dec 2009 12:08:00 +0000 (12:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/propgrid.cpp

index b5b1893ce40d87bab67115eb7ef1252b4268d702..96bd168463c362ae32327ee9ede3ffcb6948a02c 100644 (file)
@@ -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) !=