Override default save form...

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
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Override default save form...

Post by lidds »

Is there a way that I can override the default save forms with my own?
defaultSaveForm.png
Thanks in advance

Simon
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Override default save form...

Post by Tracker Supp-Stefan »

Hello Simon,

Yes there is a way but please do use the search before asking questions - as this one has already been asked and answered:
https://forum.pdf-xchange.com/ ... 66&t=25808

Cheers,
Stefan
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Override default save form...

Post by lidds »

Stefan,

I did see this post, but this does not work for me as this is overriding the save event, where what I want to do is change your standard save form when a document is close.

I am using the following code to close the document:

Code: Select all

Dim cmd As PDFXEdit.IUIX_Cmd = uiInst.CmdManager.Cmds.Find("cmd.closeAll")
Me.docPreview.Inst.ExecUICmd2(cmd.ID)
Which displays the save form, I have used the following events to try and override this, but this is not working:

Code: Select all

If e.nEventID = nIDS(CInt(IDS.e_document_performSave)) Then
            'Do your stuff
            MsgBox("Save document")
            'If the document should not be saved then we break
            If True Then
                '...
                e.pEvent.Result = 0
                'Also we can send the E_FAIL (0 means S_OK) or some other error message so that it would be displayed in the error message box
            End If
        ElseIf e.nEventID = nIDS(CInt(IDS.e_document_closed)) Then
            'Do your stuff
            MsgBox("Save document")
            'If the document should not be saved then we break
            If True Then
                '...
                e.pEvent.Result = 0
                'Also we can send the E_FAIL (0 means S_OK) or some other error message so that it would be displayed in the error message box
            End If
        ElseIf e.nEventID = nIDS(CInt(IDS.e_annots_inserted)) Then
            'disableProperties()
        End If
Thanks in advance

Simon
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Override default save form...

Post by Tracker Supp-Stefan »

Hi Simon,

In that case you will need to capture the beforeClose event:
https://sdkhelp.pdf-xchange.com/vie ... eforeClose
And mark it as handled - and then display your own dialogue as needed.

Regards,
Stefan
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Override default save form...

Post by lidds »

Hi Stefan,

I have tried the following, but this is not working. It is still showing the default save form and not displaying my messageBox. Any ideas?

Code: Select all

If e.nEventID = nIDS(CInt(IDS.e_document_beforeClose)) Then
            'Do your stuff
            MsgBox("Save document")
            'If the document should not be saved then we break
            If True Then
                '...
                e.pEvent.Result = 0
                'Also we can send the E_FAIL (0 means S_OK) or some other error message so that it would be displayed in the error message box
            End If
End if            
Thanks in advance
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Override default save form...

Post by Sasha - Tracker Dev Team »

Hello Simon,

Please read a Handled/Result description more carefully.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Override default save form...

Post by lidds »

Hi Alex,

Sorry my mistake, this is working now.

However because I am now handling the beforeClose event myself by displaying my own save form, the issue I now have is that the PDF Xchange control is not releasing the document. And therefore I get a "file in use error". What code would I need to call to properly release the document?

Thanks in advance

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

Re: Override default save form...

Post by Sasha - Tracker Dev Team »

Hello Simon,

IPXV_Document::Close should work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply