diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 7b2176a7dc..f082d735f7 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1381,6 +1381,17 @@ bool wxWindowMac::MacCanFocus() const } } +static bool wxIsWindowOrParentDisabled(wxWindow* w) +{ + while (w && !w->IsTopLevel()) + { + if (!w->IsEnabled()) + return true; + w = w->GetParent(); + } + return false; +} + void wxWindowMac::SetFocus() { if ( m_peer == NULL ) @@ -1389,6 +1400,9 @@ void wxWindowMac::SetFocus() if ( !AcceptsFocus() ) return ; + if (wxIsWindowOrParentDisabled(this)) + return; + wxWindow* former = FindFocus() ; if ( former == this ) return ;