From: Jaakko Salli <jaakko.salli@dnainternet.net>
Date: Wed, 17 Sep 2008 17:34:22 +0000 (+0000)
Subject: Added separate SetFocusOnCanvas() function so that m_editorFocused will be more relia... 
X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c29e714c378d7e3164d71e2c306d990802fe678b?ds=sidebyside

Added separate SetFocusOnCanvas() function so that m_editorFocused will be more reliable updated

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---

diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h
index 04cb4d99f2..dc75e9b1e8 100644
--- a/include/wx/propgrid/propgrid.h
+++ b/include/wx/propgrid/propgrid.h
@@ -1819,6 +1819,12 @@ protected:
                     wxVariant* pValue = NULL,
                     unsigned int selFlags = 0 );
 
+    void SetFocusOnCanvas()
+    {
+        m_canvas->SetFocusIgnoringChildren();
+        m_editorFocused = 0;
+    }
+
     bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
 
 private:
diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp
index 2229e3feae..11ef4ae1b9 100644
--- a/src/propgrid/propgrid.cpp
+++ b/src/propgrid/propgrid.cpp
@@ -3594,8 +3594,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
                 }
                 else
                 {
-                    canvas->SetFocusIgnoringChildren();
-                    m_editorFocused = 0;
+                    SetFocusOnCanvas();
                 }
             }
 
@@ -3813,8 +3812,8 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
             }
             else
             {
-                // wxGTK atleast seems to need this (wxMSW not)
-                canvas->SetFocusIgnoringChildren();
+                // Make sure focus is in grid canvas (important for wxGTK, at least)
+                SetFocusOnCanvas();
             }
 
             EditorsValueWasNotModified();
@@ -3836,8 +3835,8 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
         }
         else
         {
-            // Make sure focus is in grid
-            canvas->SetFocusIgnoringChildren();
+            // Make sure focus is in grid canvas
+            SetFocusOnCanvas();
         }
 
         ClearInternalFlag(wxPG_FL_IN_SELECT_PROPERTY);
@@ -3906,7 +3905,7 @@ bool wxPropertyGrid::UnfocusEditor()
     if ( !CommitChangesFromEditor(0) )
         return false;
 
-    m_canvas->SetFocusIgnoringChildren();
+    SetFocusOnCanvas();
     DrawItem(m_selected);
 
     return true;
@@ -4227,7 +4226,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even
     // Need to set focus?
     if ( !(m_iFlags & wxPG_FL_FOCUSED) )
     {
-        m_canvas->SetFocusIgnoringChildren();
+        SetFocusOnCanvas();
     }
 
     wxPropertyGridPageState* state = m_pState;