From: Paul Cornett Date: Wed, 31 Jul 2013 16:03:51 +0000 (+0000) Subject: defer calling SetCanFocus() on wxGTK until after creation X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4ae5ada038560a7fe793e9152f86d1d35b40f439 defer calling SetCanFocus() on wxGTK until after creation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/statbox.h b/include/wx/statbox.h index 02197a2479..d01f257969 100644 --- a/include/wx/statbox.h +++ b/include/wx/statbox.h @@ -27,7 +27,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticBoxNameStr[]; class WXDLLIMPEXP_CORE wxStaticBoxBase : public wxNavigationEnabled { public: - wxStaticBoxBase() { m_container.DisableSelfFocus(); } + wxStaticBoxBase(); // overridden base class virtuals virtual bool HasTransparentBackground() { return true; } diff --git a/src/common/statboxcmn.cpp b/src/common/statboxcmn.cpp index 487036e122..5f0f05cbeb 100644 --- a/src/common/statboxcmn.cpp +++ b/src/common/statboxcmn.cpp @@ -29,6 +29,13 @@ extern WXDLLEXPORT_DATA(const char) wxStaticBoxNameStr[] = "groupBox"; +wxStaticBoxBase::wxStaticBoxBase() +{ +#ifndef __WXGTK__ + m_container.DisableSelfFocus(); +#endif +} + // ---------------------------------------------------------------------------- // XTI // ---------------------------------------------------------------------------- diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index bd64a6076d..6d0a9b0db1 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -108,6 +108,8 @@ bool wxStaticBox::Create( wxWindow *parent, } #endif + m_container.DisableSelfFocus(); + return true; } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 3e555410ff..0285a47912 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3375,8 +3375,9 @@ void wxWindowGTK::SetFocus() void wxWindowGTK::SetCanFocus(bool canFocus) { - if ( m_widget ) - gtk_widget_set_can_focus(m_widget, canFocus); + wxCHECK_RET(m_widget, "invalid window"); + + gtk_widget_set_can_focus(m_widget, canFocus); if ( m_wxwindow && (m_widget != m_wxwindow) ) {