From: Vadim Zeitlin Date: Sun, 31 Mar 2013 01:12:15 +0000 (+0000) Subject: Explicitly trigger wxNotebook layout in wxMSW to ensure it is correct. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/80ceadc1652cf1ca6c93cf0f6657634233a6bcde Explicitly trigger wxNotebook layout in wxMSW to ensure it is correct. Due to an apparent bug in the native control implementation, space could be reserved for the second row of tabs even when the notebook was big enough to need it. Sending it an extra WM_SIZE seems to be enough to fix this. Closes #1792. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 1d69e439bb..d51c996daf 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -736,6 +736,14 @@ bool wxNotebook::InsertPage(size_t nPage, if ( m_pages.GetCount() == 1 || HasFlag(wxNB_MULTILINE) ) { AdjustPageSize(pPage); + + // Additionally, force the layout of the notebook itself by posting a + // size event to it. If we don't do it, notebooks with pages on the + // left or the right side may fail to account for the fact that they + // are now big enough to fit all all of their pages on one row and + // still reserve space for the second row of tabs, see #1792. + const wxSize s = GetSize(); + ::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(s.x, s.y)); } // now deal with the selection