Bug in that main control lost focus does not update doc.modified property  SOLVED

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
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Bug in that main control lost focus does not update doc.modified property

Post by prime clinical systems »

Hi, is there some way to check if the control has been modified, other than doc.modified property? It does not update when control loses focus, for example, I have my own close button, and I was checking this property to see whether needed to save or not, and found that if you open a document with a form field or a text annotation, type into it and then click on any control not on the pdf control, the property does not update. Here in you full demo, shows the checkbox which monitors the property, type some text, then for example, change tabs left top to some other tab and return to document tab, the checkbox remains unchecked. I believe the reason is that the edit finished events for the texteditor don't fire or something. Is there some other property? I notice that the undo button does become active while typing, and if that has undo level > 0 I could use, that, but I still believe that if undo level is fired by typing, so should the doc.modified property be updated with text change event of editors.
Capture.JPG
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Bug in that main control lost focus does not update doc.modified property

Post by prime clinical systems »

Testing some more shows the text editor change event does not fire:

If pEvent.ID = Me.PDF.Inst.Str2ID("e.document.textEditor.textChanged") Then
MsgBox "textChanged" 'type in the form fields, this message never shows.
If Not Me.PDF.Doc.Modified Then
Me.PDF.Doc.Modified = True
End If
End If
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Bug in that main control lost focus does not update doc.modified property  SOLVED

Post by Sasha - Tracker Dev Team »

Hello Clifford,

First of all, the document's undo/redo data and the field's or annotation's text's undo/redo data are two separate ones. When you are entering a TextEditor mode, then the undo/redo data is being created for the text editing alone, meaning that you can revert all of the changes you have made during typing. When you click on the pages view for example the TextEditor finishes the text edit mode and the e.document.textEditor.stopped event will be fired. Until then, the document itself won't be modified. There was a similar case with the annotations, here's the solution to it:
https://forum.pdf-xchange.com/ ... us#p104533

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Bug in that main control lost focus does not update doc.modified property

Post by prime clinical systems »

ok fine that works... just nothing intuitive about this control. To not update the dirty flag when obviously document has been changed just not logical.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Bug in that main control lost focus does not update doc.modified property

Post by Sasha - Tracker Dev Team »

Hello Clifford,

Well, when you are editing a field or annotation and not yet applied changes - the document itself stays unmodified, because you always can press Esc and cancel the editing operation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
prime clinical systems
User
Posts: 211
Joined: Sun Aug 05, 2012 5:20 pm

Re: Bug in that main control lost focus does not update doc.modified property

Post by prime clinical systems »

you don't understand doctors notes, they work very fast, and click close and will yell that they lost their notes, but anyway glad there was a fix
ce
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Bug in that main control lost focus does not update doc.modified property

Post by Sasha - Tracker Dev Team »

Hello Clifford,

Basically that's the main usage of the SDK - customizing the Editor to suit your needs.

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