From 7e530e23e16ccb64fe00236422f2f359a88fb39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20G=C3=B6pfert?= Date: Mon, 11 Jan 2016 10:29:19 +0100 Subject: [PATCH] Update selection in wxAuiNotebook correctly after tab move Update the selected state of the tab with the index corresponding to the old index of the tab which was moved. Closes #16605. --- src/aui/auibook.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index df98c33e87..d7f5d5e57b 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -2769,11 +2769,12 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) nb->m_tabs.InsertPage(page_info.window, page_info, insert_idx); nb->DoSizing(); + dest_tabs->SetActivePage(insert_idx); dest_tabs->DoShowHide(); dest_tabs->Refresh(); // set the selection in the destination tab control - nb->SetSelectionToPage(page_info); + nb->DoModifySelection(insert_idx, false); // notify owner that the tab has been dragged wxAuiNotebookEvent e2(wxEVT_AUINOTEBOOK_DRAG_DONE, m_windowId); @@ -2804,8 +2805,10 @@ void wxAuiNotebook::OnTabEndDrag(wxAuiNotebookEvent& evt) dest_tabs = tab_frame->m_tabs; if (dest_tabs == src_tabs) + { + m_curPage = evt.GetSelection(); return; - + } wxPoint pt = dest_tabs->ScreenToClient(mouse_screen_pt); wxWindow* target = NULL;