PDFium Delphi Component Docs

FormFieldZOrderAtPoint method

Component: TPdf  ·  Unit: PDFium
Hit-tests a page-space coordinate against the interactive form fields and returns the z-order of the widget covering that point

Syntax

function FormFieldZOrderAtPoint(X, Y: Double): Integer;

X, YDouble. Point in PDF page units, with the origin at the bottom-left corner of the page
ResultInteger. The z-order of the form field widget covering the point as reported by the native hit-test, or -1 when no widget covers it

Description

Form-field counterpart of LinkZOrderAtPoint. The hit-test runs through the form fill environment (FPDFPage_FormFieldZOrderAtPoint) and returns the z-order of the widget whose area covers the coordinate, so overlapping widgets are resolved the same way PDFium resolves them when routing mouse input

The call requires the form fill environment to be initialized for the document; when it is not, an EPdfError with the message Form fill environment is not initialized is raised. The current page must be active as well

For typed queries use FormFieldTypeAtPoint, which also reports the field type, or HasFormFieldAt for a presence check. Convert a mouse position to page units with DeviceToPage before calling

Remarks

Example

var PX, PY: Double;
begin
  if Pdf1.DeviceToPage(MouseX, MouseY, 0, 0, W, H, ro0, PX, PY) then
    if Pdf1.FormFieldZOrderAtPoint(PX, PY) >= 0 then
      Cursor := crIBeam; // a form widget is under the mouse
end;

See Also

FormFieldTypeAtPoint, HasFormFieldAt, LinkZOrderAtPoint, DeviceToPage