Close Active Tab & Close All Tabs but This

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
ap_mi
User
Posts: 47
Joined: Mon Aug 31, 2015 11:38 pm

Close Active Tab & Close All Tabs but This

Post 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.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17818
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Close Active Tab & Close All Tabs but This

Post 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
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Close Active Tab & Close All Tabs but This

Post 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.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply