Fix HasFocus() for composite controls.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Nov 2011 23:40:53 +0000 (23:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 18 Nov 2011 23:40:53 +0000 (23:40 +0000)
Comparing the result of DoFindFocus() with the main window of composite
control doesn't work as it can return a child window so HasFocus() still
returned false for a composite control such as generic wxListCtrl even when it
did have focus.

Just use FindFocus() instead of DoFindFocus() to fix this.

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

src/common/wincmn.cpp

index a8fee417924f5a6b81930cdd26d7dd4dd1b87cdb..16f1ed9da868b019c781afc05aba8295f4bba0fe 100644 (file)
@@ -3328,9 +3328,7 @@ void wxWindowBase::DoMoveInTabOrder(wxWindow *win, WindowOrder move)
 
 bool wxWindowBase::HasFocus() const
 {
-    wxWindowBase *win = DoFindFocus();
-    return win == this ||
-           win == wxConstCast(this, wxWindowBase)->GetMainWindowOfCompositeControl();
+    return FindFocus() == this;
 }
 
 // ----------------------------------------------------------------------------