Page 1 of 1

Close Active Tab & Close All Tabs but This

Posted: Mon Oct 17, 2016 8:58 pm
by ap_mi
Hello,

I want to be able to close the active tab and close all tabs but the active tab. I've been trying to accomplish this using commands #32937 and #33255, but I've had no luck getting this to work. Has anyone been able to accomplish this?

Came across this post:
https://www.pdf-xchange.com/forum3 ... =36&t=5594

Could it be that it's still not fixed?

Thanks.

Re: Close Active Tab & Close All Tabs but This

Posted: Tue Oct 18, 2016 9:48 am
by Tracker Supp-Stefan
Hello ap_mi,

That post is rather old, so the issue discussed there should have been fixed, but I will ask my colleagues from the dev team to take another look and confirm!

Regards,
Stefan

Re: Close Active Tab & Close All Tabs but This

Posted: Wed Oct 26, 2016 7:51 pm
by Vasyl-Tracker Dev Team
Hi ap_mi.

Unfortunately, but currently is impossible to use programmatically commands #32937(Close Active Tab) and #33255(Close All Tabs but This). These command are just for using in context menu for items in tab-bar.

Instead of using the 'Close Active Tab' you may use the #57602 (Close the Active Document) and instead of 'Close All Tabs but This' - you may make your own code that may close all opened documents excepting active one:

Code: Select all

int activeDocId;
pdfCtl.GetActiveDocument(out activeDocId);
int docCnt;
pdfCtl.GetDocumentsCount(out docCnt);

ArrayOfInt docsToClose;
for (int i=0;i<docCnt;i++)
{
   int id;
   pdfCtl.GetDocumentID(i, out id);
   if (id != activeDocId)
     docsToClose.add(id);
}

for (id : docsToClose)
     pdfCtl.CloseDocument(id);
HTH.