Hi support,
I need to get notified when a document is closed in the pxv_control's Frame/View, and I need to know the Frame/View of where the document was.
[Q1] If I go with "e.document.closed" event - how do I get to the Frame (/View) of the document that is closed? The ActiveView is null at this moment and I cannot use GetMainViewFromUIObj(doc.ActiveView.obj), where doc is IPXV_Document(pFrom).
[Q2] If I go with "e.document.beforeClose" then I can get to the Frame/View - but I'm not sure if the action (closing the document) can be stopped (outside of the event handler)? I need to be 100% sure that a document will be closed once I handle this event.
[Q3] Further, setting "pEvent.Handled = true" for "e.document.beforeClose" does not stop the document from closing (only stops the event from being propagated to other frames). In what event can I do this - stop document from closing?
[Q4] What is pEvent in both events?
-žarko
Handling events e.document.beforeClose / e.document.closed SOLVED
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.
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.
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Handling events e.document.beforeClose / e.document.closed
Hi,
To answer part of my question: I've decided to store a reference to the MainView and IPXV_Document in the e.document.beforeClose, then in the e.document.closed if the document matches the one stored, I know that document is closed (and I know its MainView - so where the document was since I do not allow moving the document in between frames/views).
The remaining 2 questions still stay: how can I stop a document from being closed?
I've tried custom handling the "cmd.close" command but it seems I cannot stop the close operation there.
Also, the cmd.close does not get executed when closing a document by its tab's close button, or "close active tab" button - so how to handle those also?
-žarko
To answer part of my question: I've decided to store a reference to the MainView and IPXV_Document in the e.document.beforeClose, then in the e.document.closed if the document matches the one stored, I know that document is closed (and I know its MainView - so where the document was since I do not allow moving the document in between frames/views).
The remaining 2 questions still stay: how can I stop a document from being closed?
I've tried custom handling the "cmd.close" command but it seems I cannot stop the close operation there.
Also, the cmd.close does not get executed when closing a document by its tab's close button, or "close active tab" button - so how to handle those also?
-žarko
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Handling events e.document.beforeClose / e.document.closed SOLVED
Ok, found it. To stop a document from closing, handle the e.document.beforeClose and specify something for the pEvent.Result value.
Case closed.
.ž
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Handling events e.document.beforeClose / e.document.closed
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Handling events e.document.beforeClose / e.document.closed
zarkogajic wrote: ↑Tue Oct 29, 2019 10:07 am
Ok, found it. To stop a document from closing, handle the e.document.beforeClose and specify something for the pEvent.Result value.
Case closed.
.ž
Hi ,
I tried the to stop closing the pdf as you have mentioned . I used the below code snippet in side e.document befoe closing event.
e.pEvent.Result = 1;
e.pEvent.Handled = true;
But it continue the execution and it fires the e.documetn_closed event and close the document.
Can you please let me know what I have misssed here?
Thank you
prasantha
-
- User
- Posts: 1370
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Handling events e.document.beforeClose / e.document.closed
Hi,
"Works for me"
What is the value of pEvent.Param1 ?
For me it is 1 (am not sure what it really means), but the SDK help states it must not be 0 for event breaking to be allowed: https://sdkhelp.pdf-xchange.com/vi ... eforeClose
p.s.
How are you closing the document?
-žarko
"Works for me"
What is the value of pEvent.Param1 ?
For me it is 1 (am not sure what it really means), but the SDK help states it must not be 0 for event breaking to be allowed: https://sdkhelp.pdf-xchange.com/vi ... eforeClose
p.s.
How are you closing the document?
-žarko
Re: Handling events e.document.beforeClose / e.document.closed
HI žarko,
Than k you for you response.
Its 1 for pEvent.Param1.
Than k you for you response.
Its 1 for pEvent.Param1.
- Tracker Supp-Stefan
- Site Admin
- Posts: 17906
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: