Page 1 of 1

wxAuiNotebook: on tab move page keeps old index

Posted: Wed Mar 03, 2010 1:51 pm
by Marcus Frenkel
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?

Posted: Wed Mar 03, 2010 5:28 pm
by timg
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.