function FormFieldZOrderAtPoint(X, Y: Double): Integer;
| X, Y | Double. Point in PDF page units, with the origin at the bottom-left corner of the page |
| Result | Integer. 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 |
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 in the same way as PDFium resolves them when routing mouse input
The call requires the form fill environment to be initialised 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
-1 means the point sits on no widget, not that the page has no form
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;