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.
This commit is contained in:
Vadim Zeitlin
2020-12-04 02:43:24 +01:00
parent 84e6e5a029
commit e98ac38dcb

View File

@@ -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);