PDFium Delphi Component Docs

FocusFormFieldAt method

Component: TPdf  ·  Unit: PDFium
Focus the form field annotation at a page point

Syntax

function FocusFormFieldAt(X, Y: Double; Modifier: Integer = 0): Boolean;

X, YDouble. Cursor position in PDF user space, not device pixels
ModifierInteger. Virtual-key modifier flags passed through to PDFium; 0 when no modifier key is held
ResultBoolean. True when an annotation exists at the point and holds focus

Description

Viewer code calls this on a mouse-down or hit-test to give the form field at the clicked location focus. If the annotation at that point already has focus nothing changes; if there is no annotation there, form focus is removed

Coordinates are in PDF user space, so a caller starting from screen coordinates must convert them with DeviceToPage first. The page must be active and the form fill environment must be initialised, otherwise the call raises an error

This wraps FORM_OnFocus and complements the existing keyboard navigation and field inspection methods; it does not synthesise a mouse event or commit a field value

See Also

FormFieldTypeAtPoint, FormFieldZOrderAtPoint, FocusNextFormField