diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 2edf86df4f..5e3c362e51 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -149,6 +149,9 @@ protected: // get the total size occupied by the radio box buttons wxSize GetTotalButtonSize(const wxSize& sizeBtn) const; + // Adjust all the buttons to the new window size. + void PositionAllButtons(int x, int y, int width, int height); + virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index de869045c1..c33b564474 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -252,6 +252,10 @@ bool wxRadioBox::Create(wxWindow *parent, // Now that we have items determine what is the best size and set it. SetInitialSize(size); + // And update all the buttons positions to match it. + const wxSize actualSize = GetSize(); + PositionAllButtons(pos.x, pos.y, actualSize.x, actualSize.y); + return true; } @@ -625,6 +629,12 @@ void wxRadioBox::DoMoveWindow(int x, int y, int width, int height) { wxStaticBox::DoMoveWindow(x, y, width, height); + PositionAllButtons(x, y, width, height); +} + +void +wxRadioBox::PositionAllButtons(int x, int y, int width, int WXUNUSED(height)) +{ wxSize maxSize = GetMaxButtonSize(); int maxWidth = maxSize.x, maxHeight = maxSize.y;