Reputation: 125
I have a class named MyListView which is derived from wxListCtrl and this class acts as page for wxNotebook.
MyListView* l = new MyListView( m_notebook, -1, m_serverLog, incoming_socket );
m_notebook->AddPage( l, "Log", true );
Inside that class it is sometimes necessary to change the caption of the tab displayed by wxNotebook.
According to the documentation, this is the function to use:
wxNotebook::SetPageText
bool SetPageText(size_t page, const wxString& text)
Sets the text for the given page.
The problem is, at this time it is not necessarily the currently selected page.
What is the best way to find out which id the page currently has by which it can be identified by above function?
Upvotes: 0
Views: 379
Reputation: 22688
Since wxWidgets 2.9.5 you can use notebook->FindPage(this) to find the index of the page in the notebook. In the previous version you could just loop over all the notebook pages yourself to find the one you're interested in (as this is what FindPage()
does anyhow).
Finally, quite often you are working with the currently visible page only, in which case you can use notebook->GetSelection() instead.
Upvotes: 1