From e98ac38dcb14fdfc55aad7deb8d0d9d4e29d3260 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 4 Dec 2020 02:43:24 +0100 Subject: [PATCH] Fix wxStatusBar::SetMinHeight() in wxMSW This was broken, possibly by 25c9b032a8 (Don't call CacheBestSize() from DoGetBestSize() implementations, 2016-04-03), as it didn't change the min size of the status bar and so it was resized to it when it was managed by wxFrame. See https://github.com/wxWidgets/wxWidgets/pull/2133 Closes #18996. --- src/msw/statusbar.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index dd69282703..bd4d9ea8b6 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -423,9 +423,12 @@ void wxStatusBar::SetMinHeight(int height) // statbar sample gets truncated otherwise. height += 4*GetBorderY(); - // We need to set the size and not the size to reflect the height because - // wxFrame uses our size and not the minimal size as it assumes that the - // size of a status bar never changes anyhow. + // Ensure that the min height is respected when the status bar is resized + // automatically, like the status bar managed by wxFrame. + SetMinSize(wxSize(m_minWidth, height)); + + // And also update the size immediately, which may be useful for the status + // bars not managed by wxFrame. SetSize(-1, height); SendMessage(GetHwnd(), SB_SETMINHEIGHT, height, 0);