X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2091f5e71a1d04cf9277565121725f764d466a06..c616c2e834192db06bbef18b9404824f563e335f:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index f98b8c45d6..1b69f1db05 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -1231,13 +1231,19 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const void wxToolBar::UpdateSize() { - // the toolbar size changed - ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); + // In case Realize is called after the initial display (IOW the programmer + // may have rebuilt the toolbar) give the frame the option of resizing the + // toolbar to full width again, but only if the parent is a frame and the + // toolbar is managed by the frame. Otherwise assume that some other + // layout mechanism is controlling the toolbar size and leave it alone. - // we must also refresh the frame after the toolbar size (possibly) changed wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if ( frame ) + if ( frame && frame->GetToolBar() == this ) + { + // the toolbar size changed + ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); frame->SendSizeEvent(); + } } // ----------------------------------------------------------------------------