Page 1 of 1

e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 12, 2020 9:59 am
by zarkogajic
Hi Support,

From what I can see, the order of events when saving a document is:

e.document.beforeSave
e.document.performSave
e.document.savePerformed
e.document.afterSave

What happens/can happen between e.document.beforeSave /e.document.performSave, and also between e.document.savePerformed / e.document.afterSave ?

Why: I have a document open in IPXV_PagesPreviewCtl, if the same document is open in pxvControl and edited -> trying to save would result in an error (as the document is locked by IPXV_PagesPreviewCtl).

I'm trying to figure out the best place and the set of actions to close the document in IPXV_PagesPreviewCtl, therefore allowing it to be saved, and reopen in IPXV_PagesPreviewCtl.

I'm thinking of checking if the document, about to be saved, is open in IPXV_PagesPreviewCtl in e.document.performSave. If so, close it in preview, and then reopen in e.document.savePerformed.

I need to be sure nothing can "hit me" by the two other events...


-žarko

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 12, 2020 11:23 am
by zarkogajic
Hi,

Ok, so e.document.beforeSave raises the Save dialog and if not canceled the e.document.performSave is executed.

How do I get the name of the file to be saved (from IID_IPXV_DocSaveEvent) in e.document.performSave?

p.s.
If successfully saved: what happens between e.document.savePerformed / e.document.afterSave is still an open question :)


Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 19, 2020 9:28 am
by zarkogajic
Hi Support,

?

To repeat:

How do I get the name of the file to be saved (from IID_IPXV_DocSaveEvent) in e.document.performSave?

And can it somehow be changed between e.document.savePerformed and e.document.afterSave ?


Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 19, 2020 3:02 pm
by zarkogajic
Hi Support,

I've made progress...

If I do a simple Save, then IPXV_DocSaveEvent.Doc.CoreDoc.SrcInfo.ActualFileName would have the file name.

If I do "Save As" or "Save Copy As" then IPXV_DocSaveEvent.Dest will be IAFS_Name and from there I can get the file name to be saved as.

Confirm? Can IPXV_DocSaveEvent.Dest be something else?

p.s.
This remains: what can happen between e.document.savePerformed and e.document.afterSave ?

-žarko

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 19, 2020 3:33 pm
by Sasha - Tracker Dev Team
Hi zarkogajic,

The Dest property will always return the IAFS_Name interface if everything is OK.
There is nothing happening between those events as of now (doubt that this will be changed).

Cheers,
Alex

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Wed Feb 19, 2020 3:41 pm
by zarkogajic
Hi Alex,

Thanks for the follow up.

Btw, it seems Dest will be null if a simple "Save" (an existing open document) is executed.

-žarko

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave  SOLVED

Posted: Thu Feb 20, 2020 8:04 am
by Sasha - Tracker Dev Team
Hi žarko,

Yes, that's the logic behind it - if we are saving into the current document then the Dest will be null.

Cheers,
Alex

Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Thu Feb 20, 2020 12:31 pm
by zarkogajic
Hi Alex,

ok, thanks. Case closed.


Re: e.document.beforeSave / e.document.performSave and e.document.savePerformed / e.document.afterSave

Posted: Thu Feb 20, 2020 12:50 pm
by Sasha - Tracker Dev Team
:)