diff --git a/docs/changes.txt b/docs/changes.txt index 98382778e2..903cfcbf7f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -565,6 +565,10 @@ All (GUI): - Fix crash in wxHTML on mal-formed elements (LukasK). - Set correct cursor when the mouse is over image map links in wxHTML (LukasK). +wxMSW: + +- It is now possible to tab into radio boxes again. + 2.9.5: (released 2013-07-15) ---------------------------- diff --git a/include/wx/containr.h b/include/wx/containr.h index 0549e6be09..3783578f40 100644 --- a/include/wx/containr.h +++ b/include/wx/containr.h @@ -62,7 +62,14 @@ public: // This can be called by the window to indicate that it never wants to have // the focus for itself. - void DisableSelfFocus() { m_acceptsFocusSelf = false; } + void DisableSelfFocus() + { m_acceptsFocusSelf = false; UpdateParentCanFocus(); } + + // This can be called to undo the effect of a previous DisableSelfFocus() + // (otherwise calling it is not necessary as the window does accept focus + // by default). + void EnableSelfFocus() + { m_acceptsFocusSelf = true; UpdateParentCanFocus(); } // should be called from SetFocus(), returns false if we did nothing with // the focus and the default processing should take place diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 5e3c362e51..a0f546df9d 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -113,10 +113,6 @@ public: virtual bool Reparent(wxWindowBase *newParent); - // we inherit a version always returning false from wxStaticBox, override - // it to behave normally - virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); } - // returns true if the platform should explicitly apply a theme border virtual bool CanApplyThemeBorder() const { return false; } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 70665bdf84..7f811c9216 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -256,6 +256,12 @@ bool wxRadioBox::Create(wxWindow *parent, const wxSize actualSize = GetSize(); PositionAllButtons(pos.x, pos.y, actualSize.x, actualSize.y); + // The base wxStaticBox class never accepts focus, but we do because giving + // focus to a wxRadioBox actually gives it to one of its buttons, which are + // not visible at wx level and hence are not taken into account by the + // logic in wxControlContainer code. + m_container.EnableSelfFocus(); + return true; }