From 14a6b6e5f0200192944ed3d35ef4a3ce4549ac70 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 24 Jun 2004 04:46:41 +0000 Subject: [PATCH] work around a bug in TabCtrl_AdjustRect which will cause a crash on win2k, or on XP with themes disabled, if the wxNB_MULTILINE style is used and the rectangle is very small, (such as when the notebook is first created.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/notebook.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index dffa7e5d60..36e746e7c8 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -471,9 +471,18 @@ void wxNotebook::AdjustPageSize(wxNotebookPage *page) // get the page size from the notebook size GetSize((int *)&rc.right, (int *)&rc.bottom); - TabCtrl_AdjustRect(m_hwnd, false, &rc); - page->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); + // This check is to work around a bug in TabCtrl_AdjustRect which will + // cause a crash on win2k, or on XP with themes disabled, if the + // wxNB_MULTILINE style is used and the rectangle is very small, (such as + // when the notebook is first created.) The value of 20 is just + // arbitrarily chosen, if there is a better way to determine this value + // then please do so. --RD + if (rc.right > 20 && rc.bottom > 20) + { + TabCtrl_AdjustRect(m_hwnd, false, &rc); + page->SetSize(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); + } } // ---------------------------------------------------------------------------- -- 2.47.2