From 4f7f7a9ce175f060a4c0e9d475c620385ee62e22 Mon Sep 17 00:00:00 2001 From: Kvaz1r Date: Sun, 11 Jul 2021 10:11:48 +0300 Subject: [PATCH] Don't send event when adding first page to wxNotebook in wxUniv Make behaviour consistent with the other ports and fix failure in wxNotebook::AddPageEvents unit test with wxUniv. Closes https://github.com/wxWidgets/wxWidgets/pull/2426 --- src/univ/notebook.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/univ/notebook.cpp b/src/univ/notebook.cpp index 74f23d8111..b801b9e29b 100644 --- a/src/univ/notebook.cpp +++ b/src/univ/notebook.cpp @@ -328,9 +328,6 @@ bool wxNotebook::InsertPage(size_t nPage, // it's enough to just redraw the tabs if ( nPages == 0 ) { - // always select the first tab to have at least some selection - bSelect = true; - Relayout(); Refresh(); } @@ -345,7 +342,11 @@ bool wxNotebook::InsertPage(size_t nPage, } else // pages added to the notebook are initially hidden { - pPage->Hide(); + // always select the first tab to have at least some selection + if ( nPages == 0 ) + ChangeSelection(0); + else + pPage->Hide(); } return true;