Fix initial wxRadioBox buttons positions in wxMSW.
We only updated the button positions when the radio box was moved or resized after being created but didn't do it initially, so a radio box created with fixed position and size didn't lay out its buttons correctly. Do lay them out immediately after creating the radio box to fix this. Closes #13912. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user