Hello,
when you call wxAuiNotebook::RemovePage(size_t) to remove the last page in a notebook, then subsequent calls to wxAuiNotebook::GetSelection() returns 0 as the selected page, instead of -1 (i.e. -1 should be returned when no page is present in the notebook). Infact m_curpage is not reset to -1, its value remains 0 when the last page is removed. I show here below a possible (maybe incorrect but here it is working) fix for this problem.
Thanks,
Luca
Index: auibook.cpp
===================================================================
RCS file: /pack/cvsroots/wxwidgets/wxWidgets/src/aui/auibook.cpp,v
retrieving revision 1.96
diff -u -r1.96 auibook.cpp
--- auibook.cpp 2007/04/05 16:31:23 1.96
+++ auibook.cpp 2007/04/12 13:27:27
@@ -2679,6 +2679,7 @@
}
else
{
+ m_curpage = -1; //?? new_idx is -1 or greater than pagecount!
// set the active page to the first page that
// isn't the one being deleted
size_t i, page_count = m_tabs.GetPageCount();
@@ -2706,8 +2707,7 @@
// set new active pane
if (new_active)
{
- m_curpage = -1;
+ SetSelection(m_tabs.GetIdxFromWindow(new_active));
}
return true;
Kirix Support Forums
Removing a page from wxAuiNotebook do not reset m_curpage.
2 posts
• Page 1 of 1
- luca
- Registered User
- Posts: 5
- Joined: Fri Jun 30, 2006 4:43 am
@@ -2706,8 +2707,7 @@
// set new active pane
if (new_active)
{
- m_curpage = -1;
+ SetSelection(m_tabs.GetIdxFromWindow(new_active));
}
By the way, the statement
- m_curpage = -1;
must not be removed at all, otherwise the initial SetSelection's "if" test does not allow to set properly a new window tab when the new index selection happen to have the same value of the one that was the current page (but which has been for example removed).
Luca
- luca
- Registered User
- Posts: 5
- Joined: Fri Jun 30, 2006 4:43 am
2 posts
· Page 1 of 1
Return to wxAUI Patches & Modifications