double click to open file

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
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

double click to open file

Post by EricAriens »

Hi,

In previous versions and also in the end user version you have the possibility to double click on the empty control to open a pdf.
The text explaining this is also visible. How do I activate this?

The control has a text property but is has the next text to it.
This property is not relevant for this class
Regards
Eric
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: double click to open file

Post by Sasha - Tracker Dev Team »

Hello Eric,

You will have to set this property in settings:

Code: Select all

pdfCtl.Inst.Settings["Docs.CanOpenByDblClk"].v = true;
pdfCtl.Inst.FireAppPrefsChanged(PDFXEdit.PXV_AppPrefsChanges.PXV_AppPrefsChange_Documents);
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: double click to open file

Post by EricAriens »

Hi,

Is it possible to detect when opening a file with the double click.
The first time a document opens I need to add a custom event handler.

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

Re: double click to open file

Post by Sasha - Tracker Dev Team »

Hello Eric,

The e.document.initialized or e.document.viewingStarted event should do the trick.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: double click to open file

Post by EricAriens »

Hi,

The initialized or viewing event fire to late for me. Is it possible to catch the double click and start the open dialog myself?
I have to do some initialization myself and have already an open file method..

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

Re: double click to open file

Post by Sasha - Tracker Dev Team »

Hello Eric,

Please check this thread - probably this solution will work for you:
https://forum.pdf-xchange.com/ ... 970#p98970

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: double click to open file

Post by EricAriens »

Hi,

I checked the thread. This method will detect all open file. I only want to detect when a file is opened with the canvas double click.

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

Re: double click to open file

Post by Sasha - Tracker Dev Team »

I see, well, there is a way to detect this. You will need to implement a custom event target for the DocumentViewsArea:
https://sdkhelp.pdf-xchange.com/vie ... tViewsArea
Then you will need to listen to the double click event and act accordingly. For example show your dialog and open the document with it. Don't forget to put the Handled flag as true - this will mean that you have handled this event and all other listeners (like default ones) won't do anything.
Here's the sample I wrote some time ago - check it out:
https://gist.github.com/Polaringu/648a34daff6bd284a773

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: double click to open file

Post by EricAriens »

Hi,

I implemented the CustomEventListner and initialized it.

Code: Select all

canvasDoubleClick = new CustomEventTarget(pdfCtl.Inst.MainFrm[0].View.DocViewsArea.Obj, this);
What is the eventcode for double click?
Or should I detect LeftMouseButtonDown or LeftMouseButtonUp and count the clicks (tricky).

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

Re: double click to open file

Post by Sasha - Tracker Dev Team »

Hello Eric,

You will need to implement a CustomEventTarget class as described in the sample and listen to the WM_LBUTTONDBLCLK 0x0203 event code (that you can look in the MSDN).

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
EricAriens
User
Posts: 130
Joined: Tue May 03, 2016 1:11 pm

Re: double click to open file

Post by EricAriens »

Hi,

That was all the info I needed.
Working like a charm :lol:

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

Re: double click to open file

Post by Sasha - Tracker Dev Team »

Great :wink:
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply