diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index f787d739d7..6ade05c7d2 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -443,7 +443,7 @@ void MyFrame::PopulateToolbar(wxToolBarBase* toolBar) wxComboBox *combo = new wxComboBox(toolBar, ID_COMBO, wxEmptyString, wxDefaultPosition, wxSize(100,-1) ); combo->Append("This"); combo->Append("is a"); - combo->Append("combobox"); + combo->Append("combobox with extremely, extremely, extremely, extremely long label"); combo->Append("in a"); combo->Append("toolbar"); toolBar->AddControl(combo, "Combo Label"); diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 901104ada5..0a67370494 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -548,7 +548,10 @@ wxToolBar::~wxToolBar() wxSize wxToolBar::MSWGetFittingtSizeForControl(wxToolBarTool* tool) const { - wxSize size = tool->GetControl()->GetBestSize(); + // Note that we intentionally use GetSize() and not GetBestSize() here as + // the control could have been added to the toolbar with the size less than + // its best size in order to avoid taking too much space. + wxSize size = tool->GetControl()->GetSize(); // This is arbitrary, but we want to leave at least 1px around the control // vertically, otherwise it really looks too cramped.