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,
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.
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];
Thanks a lot. It works perfectly fine.
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.