BeforeSaveDoc.Cancel

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

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

BeforeSaveDoc.Cancel

Post by docu-track99 »

I've been trying to stop the closing of a document in OnEvent but I've been unable to actually cancel the close of a document.

The line I'm using is:
Call tPdf1.DoVerb("Notifications.BeforeSaveDoc.Cancel", "Set", 1, Nothing)
which is only being run when the "Notifications.BeforeCloseDoc" event is fired, and if I check the property before and after that set line it does in fact change, but the document still closes.

Any assistance would be appreciated.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: BeforeSaveDoc.Cancel

Post by Vasyl - PDF-XChange »

Hi, docu-track99.

To skip closing of document:

Code: Select all

eventhandler OnEvent(type, name, ...)
{
     if (type==PXCVA_OnNamedNotify AND name=="Notifications.BeforeCloseDoc")
     {
           tPdf1.SetProperty("Notifications.BeforeCloseDoc.Cancel", 1, 0);
     }
}
Check your code again...

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: BeforeSaveDoc.Cancel

Post by docu-track99 »

Hmmm, interesting.

The only difference between our two lines of code is the "Call" statement at the start of the line. (Your line does work, while mine doesn't, this is all in VB6.)

Most of your example lines follow the "Call *control*.SetProperty(*Stuff*)", so that's the format that we've been following. I'm pretty sure this is the first instance where we've had to drop the "Call" statement. I'm not sure if that means there's something different between the different underlying things to cause this difference in behaviour...

Anyways, thanks for the help!
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7362
Joined: Wed Mar 25, 2009 10:37 pm

Re: BeforeSaveDoc.Cancel

Post by Paul - PDF-XChange »

make sure to let us know if you need anythign further. :-)
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: BeforeSaveDoc.Cancel

Post by Vasyl - PDF-XChange »

Look to your code:

Call tPdf1.DoVerb("Notifications.BeforeSaveDoc.Cancel", "Set", 1, Nothing)

- but your "Notifications.BeforeSaveDoc" is NOT EQUAL to "Notifications.BeforeCloseDoc" correct name !

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Re: BeforeSaveDoc.Cancel

Post by docu-track99 »

How did I miss that?

Especially since I know I didn't copy them in from somewhere, but would have typed them in...

Oh well, good to know it was just operator error rather than anything weird or "unexplainable" in the code/control.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: BeforeSaveDoc.Cancel

Post by Stefan - PDF-XChange »

:)