Kirix Support Forums

wxAuiNotebook reordered AdvanceSelection()

Please post any wxAUI patches or modifications you've created here. Thanks!

wxAuiNotebook reordered AdvanceSelection()

Postby ghostdev85 on Tue Apr 08, 2008 9:42 pm

Hello,

I'm sure a lot of you notices that after you reorder(drag and dropped) the wxAuiNotebook, AdvanceSelection() does not give you the desired "page advancing" but rather the pages are jumping around...
Here is the patch for AdvanceSelection in order to correctly do the AdvanceSelection()

Code: Select all
      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) (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();
            tabctrl->GetWindowFromIdx(newPage)->SetFocus();
         }
      }
ghostdev85
Registered User
 
Posts: 13
Joined: Sat Jan 13, 2007 6:03 am

Return to wxAUI Patches & Modifications