diff --git a/docs/changes.txt b/docs/changes.txt index d266e1cd48..17c3d6495f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -142,6 +142,7 @@ wxMSW: highlight, just as if the control were created in report mode initially. - Use correct index of the right-clicked column in wxListCtrl in the corresponding event even when the control is scrolled horizontally. +- Implement wxRadioBox::Reparent() correctly (Vince Harron). wxGTK: diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 05bccdc050..9fe8ae5cb7 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -111,6 +111,8 @@ public: } #endif // wxUSE_HELP + 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(); } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 4ca4bb2ae9..5f527f323b 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -443,6 +443,25 @@ void wxRadioBox::DoSetItemToolTip(unsigned int item, wxToolTip *tooltip) #endif // wxUSE_TOOLTIPS +bool wxRadioBox::Reparent(wxWindowBase *newParent) +{ + if ( !wxStaticBox::Reparent(newParent) ) + { + return false; + } + + HWND hwndParent = GetHwndOf(GetParent()); + for ( size_t item = 0; item < m_radioButtons->GetCount(); item++ ) + { + ::SetParent((*m_radioButtons)[item], hwndParent); + } +#ifdef __WXWINCE__ + // put static box under the buttons in the Z-order + SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); +#endif + return true; +} + WX_FORWARD_STD_METHODS_TO_SUBWINDOWS(wxRadioBox, wxStaticBox, m_radioButtons) // ----------------------------------------------------------------------------