Avoid events when implicitly selecting first wxBookCtrl page.
The first page added to a wxBookCtrlBase-derived control is always selected, even if "bSelect" argument of AddPage() was false. This is necessary because a non-empty book control must always have a selection but the "selection changed" event generated when doing it is unexpected. Fix this by not generating any events when the first page is implicitly selected. Closes #12075. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -842,16 +842,7 @@ bool wxNotebook::InsertPage(size_t nPage,
|
||||
m_selection++;
|
||||
}
|
||||
|
||||
// some page should be selected: either this one or the first one if there
|
||||
// is still no selection
|
||||
int selNew = wxNOT_FOUND;
|
||||
if ( bSelect )
|
||||
selNew = nPage;
|
||||
else if ( m_selection == wxNOT_FOUND )
|
||||
selNew = 0;
|
||||
|
||||
if ( selNew != wxNOT_FOUND )
|
||||
SetSelection(selNew);
|
||||
DoSetSelectionAfterInsertion(nPage, bSelect);
|
||||
|
||||
InvalidateBestSize();
|
||||
|
||||
|
Reference in New Issue
Block a user