PDFium Delphi Component Docs

FocusNextFormField method

Component: TPdfView  ·  Unit: PDFium
Works with the current-page AcroForm logical focus cursor for keyboard, speech and accessibility workflows

Syntax

function FocusNextFormField: Integer;

function FocusNextFormField(AcrossPages: Boolean; WrapDocument: Boolean = True; MaxPagesToScan: Integer = 256): Integer; overload;

Return Value

Integer. The newly focused field index or -1 when no field can be focused

Description

The no-argument overload keeps the existing current-page cycle through FormFieldTabOrder; passing AcrossPages=False has the same behaviour

Passing AcrossPages=True moves forward through the current page and then later pages, skipping pages without eligible fields; success changes the viewer's PageNumber and returns the new page-local field index without changing the TPdf document cursor

Use these members when an application needs to walk fields from code, drive voice-assisted form filling or expose the active field to an accessibility layer without relying on mouse hit testing

Both overloads follow each page's declared R/C/S/A/W policy and its documented fallback through FormFieldTabOrder; explicit cross-page traversal additionally filters ineligible widgets

Remarks

Example

if PdfView1.FormFieldCount > 0 then
  PdfView1.FocusFormField(0);
ShowMessage(PdfView1.FocusedFormFieldText);

See Also

FormField, FormFieldCount, FormFieldInfo, FormFieldTabOrder, FocusedFormFieldIndex