Hello,
I recently installed the newest update and I am currently experimenting with the PDF-Annotation functionality.
When I found the attribute TPDFAnnotation.StringValue I thought that maybe it could be used like a Dictionary to establish an internal annotation structure with specified keys and values, but there is something that I don't understand.
Everything worked as expected until I tried something generic like this:
procedure TForm1.Button1Click(Sender: TObject);
Var I : Integer;
begin
//ImageEnView1.PdfViewer.Annotations[0] being an existing text-annotation without assigned StringValues
For I := 0 to 3
Do ImageEnView1.PdfViewer.Annotations[0].StringValue['XYZ' + I.ToString] := 'Test';
I := 0;
While not (ImageEnView1.PdfViewer.Annotations[0].StringValue['XYZ' + I.ToString] = '')
Do Begin
ShowMessage(ImageEnView1.PdfViewer.Annotations[0].StringValue['XYZ' + I.ToString]);
Inc(I);
End;
end;
I expected this loop to break at I = 4, instead however it turns out to be an endless loop in which ShowMessage always throws out 'Test'.
Obviously the function behind StringValue is an API-call and the comments declare it to be experimental, but I would simply like to understand it to avoid using it in an erroneous fashion.
Am I doing something wrong in this example or would it be better to avoid using StringValue in this fashion or even alltogether?