Hello,
The wxAuiNotebook does not reorder itself when the page is being reordered (m_tabs variable), and if I were to use the AdvanceSelection() member function, the result would be a weird jumpy tabs after user have reordered to tabs... Is there a way to fix this?
Thank you...
Kirix Support Forums
wxAuiNotebook AdvanceSelection question
6 posts
• Page 1 of 1
- ghostdev85
- Registered User
- Posts: 13
- Joined: Sat Jan 13, 2007 6:03 am
Re: wxAuiNotebook AdvanceSelection question
Hello,
Thanks for the report. Can you paste some code to help me duplicate this problem? It would be best if you could show me how to duplicate it on the wxAUI sample.
All the best,
Ben
Thanks for the report. Can you paste some code to help me duplicate this problem? It would be best if you could show me how to duplicate it on the wxAUI sample.
All the best,
Ben
Ben Williams
Kirix Support Team
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: wxAuiNotebook AdvanceSelection question
Hello,
I don't think it is a bug... But here it goes...
You can't simulate it in the AUI sample yet... Just do a button or whatever you can trigger, when pressing the button (or menu, etc) call the AdvanceSelection() in the wxAuiNotebook... It works correctly initially, but after you reorder the wxAuiNotebook tabs, the AdvanceSelection() seem to use the old order to do the "advance selection"...
Thank you...
I don't think it is a bug... But here it goes...
You can't simulate it in the AUI sample yet... Just do a button or whatever you can trigger, when pressing the button (or menu, etc) call the AdvanceSelection() in the wxAuiNotebook... It works correctly initially, but after you reorder the wxAuiNotebook tabs, the AdvanceSelection() seem to use the old order to do the "advance selection"...
Thank you...
- ghostdev85
- Registered User
- Posts: 13
- Joined: Sat Jan 13, 2007 6:03 am
Re: wxAuiNotebook AdvanceSelection question
Hello,
I've looked through the codes, and I personally think that the AdvanceSelection member function of wxAuiNotebook should be as follow...(Note the following code does not necessarily follows wxWidgets guidelines)
Am I correct?
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
wxMessageBox("A");
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
}
}
Thank you...
I've looked through the codes, and I personally think that the AdvanceSelection member function of wxAuiNotebook should be as follow...(Note the following code does not necessarily follows wxWidgets guidelines)
Am I correct?
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
wxMessageBox("A");
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
}
}
Thank you...
- ghostdev85
- Registered User
- Posts: 13
- Joined: Sat Jan 13, 2007 6:03 am
Re: wxAuiNotebook AdvanceSelection question
Sorry... The code should be:
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else;
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
tabctrl->Refresh();
}
}
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else;
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
tabctrl->Refresh();
}
}
- ghostdev85
- Registered User
- Posts: 13
- Joined: Sat Jan 13, 2007 6:03 am
Re: wxAuiNotebook AdvanceSelection question
Sorry again...
This should be the code...
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else;
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
tabctrl->Refresh();
tabctrl->Update();
tabctrl->DoShowHide();
}
}
Thank you...
This should be the code...
void AdvanceSelection(bool forward = true) {
wxAuiTabCtrl *tabctrl = GetActiveTabCtrl();
int newPage = -1;
if(forward == true)
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = 0;
else if (tabctrl->GetActivePage() < (int) (tabctrl->GetPages().GetCount() - 1))
newPage = tabctrl->GetActivePage() + 1;
}
else;
else
if (tabctrl->GetPages().GetCount() > 1)
{
if (tabctrl->GetActivePage() == -1)
newPage = (int) ((int)tabctrl->GetPages().GetCount() - 1);
else if (tabctrl->GetActivePage() > 0)
newPage = tabctrl->GetActivePage() - 1;
}
if (newPage != -1)
{
tabctrl->SetActivePage(newPage);
tabctrl->Refresh();
tabctrl->Update();
tabctrl->DoShowHide();
}
}
Thank you...
- ghostdev85
- Registered User
- Posts: 13
- Joined: Sat Jan 13, 2007 6:03 am
6 posts
· Page 1 of 1
Return to wxAUI Questions, Thoughts & Feedback