To solve my problem I overloaded wxAuiNotebook to veto the event
EVT_AUINOTEBOOK_PAGE_CHANGED and call RemovePage() on event
EVT_AUINOTEBOOK_PAGE_CLOSE.
Here is the interesting code in cpp file:
- Code: Select all
BEGIN_EVENT_TABLE(MyNotebook, wxAuiNotebook)
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, MyNotebook::OnPageChanged)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, MyNotebook::OnPageClose)
END_EVENT_TABLE()
void MyNotebook::OnPageClose(wxAuiNotebookEvent& evt)
{
RemovePage(evt.GetSelection());
evt.Veto();
}
void MyNotebook::OnPageChanged(wxAuiNotebookEvent& evt)
{
evt.Veto();
}
[/EDIT]
Hello,
I work on Windows XP / VS2005
My app derives from wxAuiMDIParentFrame which contains (through a wxAuiManager) 2 wxAuiMDIChildFrame which contains in its turn (through another wxAuiManager) 1 wxAuiNotebook (among others). The Notebook contain 8 pages.
Inheritance:
MyParent : public wxAuiMDIParentFrame
MyChild : public wxAuiMDIChildFrame
MyNotebook : public wxAuiNotebook
MyParent.wxAuiManager[]{ MyChild.wxAuiManager[]{ MyNotebook } }
My problem is that when I close the first page of MyNotebook, it close the first MyChild tab, idem for the second, etc.
Moreover, I can access in the first two pages of MyNotebook (Strangely I have two Childs...) but not in the others (the app crashes)!
In step by step debug mode I am taken in the file line 2501:
C:\wxWidgets-2.8.3\src\common\wincmn.cpp
---
wxFAIL_MSG( _T("window that captured the mouse didn't process wxEVT_MOUSE_CAPTURE_LOST") );
---
The event object incriminated is wxAuiTabCtrl.
Thank you in advance for your Precious help.