ImageEn, unit iexPdfiumCore

TPdfFormFieldList.FindFormFieldAt

TPdfFormFieldList.FindFormFieldAt


Declaration

function FindFormFieldAt(Pt: TDPoint): Integer; overload;
function FindFormFieldAt(Pt: TPoint): Integer; overload;


Description

Returns the index of any form field found on the page at the specified position (in terms of PDF points).
Result will be -1 if no form field is found.

Note: PDF pages are specified Bottom-Up, i.e. Y=0 refers to the bottom of the page/screen. Y=PageHeight refers to the top of the page/screen


Example

// Select the clicked form field
procedure TfrmMain.ImageEnView1MouseDown(Sender: TObject; Button: TMouseButton;
    Shift: TShiftState; X, Y: Integer);
var
  idx: Integer;
  pt: TDPoint;
begin
  pt  := ImageEnView1.PdfViewer.ScrToPage( X, Y, True );
  idx := ImageEnView1.PdfViewer.FormFields.FindFormFieldAt( pt );
  if idx > -1 then
  begin
    ImageEnView1.PdfViewer.FormFields.HighlightedIndex := idx;
    ImageEnView1.Invalidate();
  end;
end;