Highlight a ptField of the document to indicate that the field cannot be left blank

Hi,

I am using PDFNET SDK for an application on iPhone(iOS). Requirement is to highlight a field which takes text as input. Need to specify to the user that the field cannot be left blank by drawing a border around it. Kindly let me know if this is possible to be implemented and if so please post a code snippet as how to achieve the same.

Thanks & Regards,

Hi, I think the following post will answer your question.

https://groups.google.com/forum/?fromgroups#!searchin/pdfnet-sdk/custom$20appearance/pdfnet-sdk/WBemgoVzYcg/C_U3jamqlLoJ

Thank you Ryan, I understand from the post that background color of Checkbox widget is being set. My requirement is for a border around a simple Widget which takes entry of type text. Please note that the border needs to be present even before the widget is clicked on/activated.

Here is a piece of code that I have used to draw the border around the widget:
PTWidget *w=[[PTWidget alloc] initWithAnn:annot]; //where annot is an object of type PTAnnot

PTColorPt *ptColor = [[PTColorPt alloc] initWithX:100.0 y:100.0 z:100.0 w:0.0];

[w SetBorderColor:ptColor CompNum:4];

Using the above code snippet I was not successful in getting the red border around the the widget. Kindly help me resolve this issue. Also, it will be helpful if a sample code is provided.

Regards,

Hi, the colors should be a value from 0-1, so you are setting a white border that way.

So for red you would call the following.

`
PTColorPt *ptColor = [[PTColorPt alloc] initWithX:1.0 y:0.0 z:0.0 w:0.0];
[ptColor SetColorantNum: 3];
[w SetBorderColor:ptColor CompNum:3];

`

If you are doing this while the file is being viewed in PDFViewCtrl, then you need to do the following

[view DocLock: doc]; ... above code [w RefreshAppearance]; [view UpdateWithAnnot:w, page_num]; [view DocUnlock: doc];

Hi Ryan,

Thanks a lot. It works perfectly fine.

Hi,

I have another query related to the same topic. Is it not possible to make the border around the field visible when the field is not selected, that is, when the focus is not on the field.

Thanks,