From b0f780439c9967c7eed7d871cb8eadaa6f8952b2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 3 Oct 2014 01:52:19 +0000 Subject: [PATCH] Fix wrong wxStatusBar height in wxMSW in some circumstances. Creating the status bar before the menu bar but associating it with the frame after creating the menu bar resulted in a status bar of completely wrong height. Fix this by enforcing the default height on the status bar when it's attached to the frame. Closes #10956. [This is the backport of r76417 from trunk.] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/frame.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index c94986f83e..3e56f5975f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -620,6 +620,7 @@ wxMSW: - Fix height of initially empty wxBitmapComboBox (Artur Wieczorek). - Fix setting label of submenu items (Artur Wieczorek). - Fix using Esc as accelerator in the menus. +- Fix wrong initial status bar height in some cases (Artur Wieczorek). 3.0.1: (released 2014-06-15) diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 8c1b178657..113420452e 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -286,6 +286,13 @@ void wxFrame::PositionStatusBar() int w, h; GetClientSize(&w, &h); + // Resize the status bar to its default height, as it could have been set + // to a wrong value before by WM_SIZE sent during the frame creation and + // our status bars preserve their programmatically set size to avoid being + // resized by DefWindowProc() to the full window width, so if we didn't do + // this here, the status bar would retain the possibly wrong current height. + m_frameStatusBar->SetSize(wxDefaultSize, wxSIZE_AUTO_HEIGHT); + int sw, sh; m_frameStatusBar->GetSize(&sw, &sh);