From f197e6520a43d87439a7358ba26b8febf9defa40 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 15 Jul 2013 17:31:25 +0000 Subject: [PATCH] keeping selected page, fixes #15334 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/notebook_osx.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/osx/notebook_osx.cpp b/src/osx/notebook_osx.cpp index bbe6f0a4cd..50cc1bacfe 100644 --- a/src/osx/notebook_osx.cpp +++ b/src/osx/notebook_osx.cpp @@ -177,8 +177,15 @@ wxNotebookPage* wxNotebook::DoRemovePage(size_t nPage) MacSetupTabs(); - if (m_selection >= (int)GetPageCount()) - m_selection = GetPageCount() - 1; + if ( m_selection >= (int)nPage ) + { + if ( GetPageCount() == 0 ) + m_selection = wxNOT_FOUND; + else + m_selection = m_selection ? m_selection - 1 : 0; + + GetPeer()->SetValue( m_selection + 1 ) ; + } if (m_selection >= 0) m_pages[m_selection]->Show(true); -- 2.47.2