git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47000
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
if (!(m_pressed_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
{
wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
if (!(m_pressed_button->cur_state & wxAUI_BUTTON_STATE_DISABLED))
{
wxAuiNotebookEvent evt(wxEVT_COMMAND_AUINOTEBOOK_BUTTON, m_windowId);
+ evt.SetSelection(GetIdxFromWindow(m_click_tab));
evt.SetInt(m_pressed_button->id);
evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
evt.SetInt(m_pressed_button->id);
evt.SetEventObject(this);
GetEventHandler()->ProcessEvent(evt);
// but does not destroy the window
bool wxAuiNotebook::RemovePage(size_t page_idx)
{
// but does not destroy the window
bool wxAuiNotebook::RemovePage(size_t page_idx)
{
+ // save active window pointer
+ wxWindow* active_wnd = NULL;
+ if (m_curpage >= 0)
+ active_wnd = m_tabs.GetWindowFromIdx(m_curpage);
+
+ // save pointer of window being deleted
wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx);
wxWindow* new_active = NULL;
wxWindow* wnd = m_tabs.GetWindowFromIdx(page_idx);
wxWindow* new_active = NULL;
+ else
+ {
+ // we are not deleting the active page, so keep it the same
+ new_active = active_wnd;
+ }
if (button_id == wxAUI_BUTTON_CLOSE)
{
if (button_id == wxAUI_BUTTON_CLOSE)
{
- int selection = tabs->GetActivePage();
+ int selection = evt.GetSelection();
if (selection != -1)
{
wxWindow* close_wnd = tabs->GetWindowFromIdx(selection);
if (selection != -1)
{
wxWindow* close_wnd = tabs->GetWindowFromIdx(selection);
// ask owner if it's ok to close the tab
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(close_wnd));
// ask owner if it's ok to close the tab
wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, m_windowId);
e.SetSelection(m_tabs.GetIdxFromWindow(close_wnd));