Hello,
I am trying to cancelling the closing of a document within Notifications.BeforeCloseDoc in OnEvent, but I can't seem to figure it out.
I've tried running calling SetProperty on Notifications.BeforeCloseDoc.Cancel, passing in a value of 1, but the document still closes.
I also tried setting DataOut of OnEvent to 1, but that doesn't work either.
How do I prevent a document from closing in the BeforeCloseDoc event?
Preventing a document from closing in BeforeCloseDoc event
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 34
- Joined: Wed Oct 09, 2013 5:58 pm
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Preventing a document from closing in BeforeCloseDoc eve
Hi, Daniel.
HTH
Please be sure that you changed the "Cancel" property inside your OnEvent procedure:I've tried running calling SetProperty on Notifications.BeforeCloseDoc.Cancel, passing in a value of 1, but the document still closes.
Code: Select all
youreventhandler OnEven(type, name...)
{
if ((type == PXCVA_OnNamedNotify) AND (name == "Notifications.BeforeCloseDoc"))
{
int docID = 0;
pdfViewer.GetProperty(name + ".DocID", out docID);
if (ConditionToPreventCloseDoc(docID))
{
pdfViewer.GetProperty(name + ".Cancel", 1);
}
}
}
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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 34
- Joined: Wed Oct 09, 2013 5:58 pm
Re: Preventing a document from closing in BeforeCloseDoc eve
Thanks for the information. I believe the method used should be SetProperty (not GetProperty). When I use SetProperty, it works. 

-
- Site Admin
- Posts: 7361
- Joined: Wed Mar 25, 2009 10:37 pm
Re: Preventing a document from closing in BeforeCloseDoc eve

Best regards
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
-
- Site Admin
- Posts: 2445
- Joined: Thu Jun 30, 2005 4:11 pm
Re: Preventing a document from closing in BeforeCloseDoc eve
Sure, the SetProperty instead of GetProperty must be used, sorry for my auto-mistake. 

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.
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.