Modified-flag set after losing focus on textbox annotation

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
divspirit
User
Posts: 14
Joined: Tue Sep 23, 2014 7:00 am

Modified-flag set after losing focus on textbox annotation

Post by divspirit »

Hi,

In our application we export and import annotations in xfdf – format. We use the pdfXchangeViewer 2.5 ActiveX, build 312.1.
When the document is closed, we check the modified-flag in order to know whether there are any changes to save.

Our problem is that when a user makes a Textbox-annotation, types some text in it, and closes immedatly the document (while the textbox still has focus), the annotation is not saved. That is because the modified-flag is set after losing the focus on the texbox.


I found that as long as the texbox-annotation has focus, the annotation is not yet visible within the document. When I make a textbox-annotation, keep focus on it, open the javascript-console and execute:

console.println(this.getAnnots().length);

no annotations are found.

We want the annotion to be visible within the document before we close the document, in order to be able to save the annotation before closing.
I tried to find methods in the API that would cause to leave focus from the texbox before closing the document, so the modified flag would be set and the annotation would be noticed, but without any result. I tried ‘Flush’ but it didn’t work.

Is there a way to change the focus programmatically, or is there another way to solve this problem?

Thanx,
Arnold
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Modified-flag set after losing focus on textbox annotati

Post by Vasyl-Tracker Dev Team »

Hi Arnold.

Please details: in which way exactly user closes the document?
1. by using original pdf-viewer's UI(documents tab bar, menu command, shortcut etc.)?
2. by closing your own container, that embeds our pdf-viewer control?
3. by button on your own toolbar that calls the pdfViewerCtl.CloseDocument() routine?
...

Best
Regards.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
divspirit
User
Posts: 14
Joined: Tue Sep 23, 2014 7:00 am

Re: Modified-flag set after losing focus on textbox annotati

Post by divspirit »

Hello Vasyl,

No. 2: by closing our own container that embeds our pdf-viewer control. The pdf-viewer control is opened in a widget.

In order to close the document, the user closes the widget.

On closing the widget, first the annotations are extracted and saved, the control is closed (self._pdf.CloseDocument(0, PXCVA_Flags.PXCVA_NoUI);), and then the widget is closed.

regards,
Arnold
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Modified-flag set after losing focus on textbox annotati

Post by Vasyl-Tracker Dev Team »

Hi Arnold.

Try to call:

self._pdf.FlushDocument(0, PXCVA_Sync);

before calling of CloseDocument.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
divspirit
User
Posts: 14
Joined: Tue Sep 23, 2014 7:00 am

Re: Modified-flag set after losing focus on textbox annotati

Post by divspirit »

Hi Vasyl,

Thank you, FlushDocument(0, PXCVA_Sync) works! :)

Before I posted this issue I tried FlushDocument, but with the PXCVA_NoUI - flag. That didn't work. With the PXCVA_Sync - flag it does.

Again, thanx a lot!

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

Re: Modified-flag set after losing focus on textbox annotati

Post by Tracker Supp-Stefan »

Glad we could help divspirit!

Cheers,
Stefan
Post Reply