wxAuiNotebook: on tab move page keeps old index

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Marcus Frenkel
Experienced Solver
Experienced Solver
Posts: 79
Joined: Thu Sep 25, 2008 12:14 am

wxAuiNotebook: on tab move page keeps old index

Post by Marcus Frenkel » Wed Mar 03, 2010 1:51 pm

When I move a tab in AuiNotebook, I would like to change the labels of the tabs so that they show the actual tab position. Example:

[Tab 1] [Tab 2] [Tab 3] [Tab 4]

When I move Tab 3 before Tab 1, wxEVT_COMMAND_AUINOTEBOOK_END_DRAG is fired in which I have:

Code: Select all

for (int i=0; i < AuiBook->GetPageCount(); i++ ) {
 AuiBook->SetPageText(i, wxT("Tab ") +   wxString::Format(wxT("%i"),i) );
The problem is that GetPageText(0) doesn't return the tab at zero position, but the tab that had zero position when tabs were created first time. When I move a tab left or right, it keeps the old index position.

In order to find the right index I also tried the following but without success:
AuiBook->GetPageIndex( AuiBook->GetPage(i) )

Any help?

Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post by timg » Wed Mar 03, 2010 5:28 pm

I was looking for something similar - I needed to get the pages in the order they are displayed after the user rearranged them.

I found this patch. It did what I needed, but from the comments, it's not quite perfect.


Post Reply