Multiple TPXV_Control Objects

PDF-XChange Editor SDK for Developers

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

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Multiple TPXV_Control Objects

Post by jeffp »

I'm using two TPXV_Control objects in my application. One acts like an editor and can have multiple documents open (Docs.SingleWnd = true). The other acts like a preview window and can only have one document open (Docs.SingleWnd = false);. Each control has its own MainFrame and I keep a separate User Settings file for both and I reload when I switch between this controls in my program.

However, I'm having a few issues.

First, if I have docA open in the Preview control and the switch to the Editor control and try to open docA, nothing happens. I'm sure this is because it is already open in the Preview control. But is there a way to show docA in the Editor control as well? Or display a message saying can't open the document because it is already open?

Second, even though I have two Control objects, the DocCount call returns to total opened docs in both controls combined. Is there a way to know what documents are open in what controls?

Thanks.

Jeff
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Multiple TPXV_Control Objects

Post by Sasha - Tracker Dev Team »

Hello Jeff,

Well there is a way of doing this by using this code:

Code: Select all

PDFXEdit.IPXV_MainFrame firstMainFrame = pdfCtl.Inst.MainFrm[0];
firstMainFrame.OpenDocFromPath(@"D:\test.tmp.pdf");
PDFXEdit.IPXV_MainFrame secondMainFrame = pdfCtl.Inst.MainFrm[1];
secondMainFrame.OpenDocFrom(pxcInst.OpenDocumentFromFile(@"D:\test.tmp.pdf", null));
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Multiple TPXV_Control Objects

Post by jeffp »

Ok. That should work in the context of my Preview control since I will open PDF files into that control via my own code.

However, the Editor control I use, the user will be opening files via your Open button on the Editor toolbar. In that case I don't have control over the open procedure. So in that case, if the file the user wants to open is already loaded in the Preview control, it will just do nothing. Is there a way around this specific case?

Also, what about my question related to figuring out while documents are open in which Controls?

--Jeff
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Multiple TPXV_Control Objects

Post by Sasha - Tracker Dev Team »

Hello Jeff,

You will need to handle the cmd.open command execution and insert your code there. There were multiple topics about this - you can try using search and try to find them by yourself.

As for your second question. The Control itself is only the wrapper - the real singleton is the IPXV_MainFrame. To get the documents from the needed main frame, use this:
IPXV_MainFrame->View(IPXV_MainView)->DocViewsArea(IPXV_DocumentViewsArea)->DocViews(IPXV_DocViewsList)->Item(IPXV_DocumentView)->Doc

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply