FieldFocusChanged event parameter  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
askelly
User
Posts: 37
Joined: Wed Mar 15, 2017 4:01 pm

FieldFocusChanged event parameter

Post by askelly »

When a user clicks into an AcroForm field with a format category of Date, Acrobat DC adds a button to the right of the field that drops down a calendar control. I am migrating an app from Acrobat to Tracker and a tester has pointed out that Tracker lacks that feature. I figured I could just handle "e.document.fieldFocusChanged" and drop down a calendar similar to Acrobat, but so far I'm unable to determine which field is referenced by the event. The documentation at https://sdkhelp.pdf-xchange.com/vie ... cusChanged states that Param1 is not used, but I can see that Param1 contains a unique value for each field on the form. What does that value represent and how can I get an IPXC_FormField from it? Also, if there's an easier or more direct way to accomplish the drop down calendar please let me know. Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: FieldFocusChanged event parameter

Post by Sasha - Tracker Dev Team »

Hello askelly,

We just had a meeting and it was told that this will be implemented soon. Meanwhile, you can use the event you mentioned - I updated the description on Wiki page.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
askelly
User
Posts: 37
Joined: Wed Mar 15, 2017 4:01 pm

Re: FieldFocusChanged event parameter

Post by askelly »

Thanks, that works. I think the documentation could be clearer that Param1 contains a pointer to an IPXC_Annotation. I was able to get it like this (VB.Net):

Code: Select all

Dim Annot As PDFXEdit.IPXC_Annotation = System.Runtime.InteropServices.Marshal.GetTypedObjectForIUnknown(e.pEvent.Param1, GetType(PDFXEdit.IPXC_Annotation))
Is there a more direct way within the SDK?

Also, I haven't been able to figure out how to determine if a field has a format category of Date. Is that information accessible somewhere in the SDK?

Finally, do you have an ETA on when the calendar dropdown will be added? If it will be within the next month or two then I'm wasting effort trying to roll my own. Thanks!
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: FieldFocusChanged event parameter

Post by Sasha - Tracker Dev Team »

Hello askelly,

Well I did provide links to the annotation and field interfaces though I did not write the interface's name directly.
The cast that you've done is correct - I am using "as" in C# or the way that you described.
To get the information whether it's a Date field or not, use the Flags property of the IPXC_FormField - it should contain the PXC_FormFieldFlag.TFF_Date as a bit flag.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
askelly
User
Posts: 37
Joined: Wed Mar 15, 2017 4:01 pm

Re: FieldFocusChanged event parameter

Post by askelly »

The TFF_Date flag seems to not be working. If I view a particular field's properties in PDF-XChange Editor it has "Category" set to "Date" in the "Format Value" section, but the flags are zero in the SDK. Other flags are working as expected. I'm using build 321. Thanks.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: FieldFocusChanged event parameter  SOLVED

Post by Sasha - Tracker Dev Team »

Hello askelly,

Just checked - that flag is not yet used in our inner code. Try using this piece of code instead:

Code: Select all

PDFXEdit.IPXS_Inst sInst = (PDFXEdit.IPXS_Inst)pdfCtl.Inst.GetExtension("PXS");
uint nAtom = sInst.StrToAtom("S");
for (uint i = 0; i < pdfCtl.Doc.CoreDoc.AcroForm.FieldsCount; i++)
{
	bool bIsDate = false;
	PDFXEdit.IPXC_FormField fld = pdfCtl.Doc.CoreDoc.AcroForm.Field[i];
	for (uint j = 0; j < fld.WidgetsCount; j++)
	{
		PDFXEdit.IPXC_Annotation widget = fld.Widget[j];
		if (widget != null)
		{
			pdfCtl.Doc.CoreDoc.CosDocument.LockDocument();
			PDFXEdit.IPXS_PDFVariant aa = widget.PDFObject.Dict_Get("AA");
			if (aa != null)
			{
				PDFXEdit.IPXS_PDFVariant f = aa.Dict_Get("F");
				if (f != null)
				{

					string sS = f.Dict_GetStringA(nAtom, "");
					if (sS.Equals("JavaScript"))
					{
						string sJS = f.Dict_GetString("JS", "");
						if (sJS.Contains("AFDate_Format"))
							bIsDate = true;
					}
				}
			}
			pdfCtl.Doc.CoreDoc.CosDocument.UnlockDocument();
		}
	}
}
As for the ETA - we will try add this feature soon - probably for the next release.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
askelly
User
Posts: 37
Joined: Wed Mar 15, 2017 4:01 pm

Re: FieldFocusChanged event parameter

Post by askelly »

That works. Thank you!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17948
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: FieldFocusChanged event parameter

Post by Tracker Supp-Stefan »

Glad to hear it worked askelly!

Cheers,
Stefan
Post Reply