PDFiumPas 文件

OnKeyPress event

元件: TPdfView  ·  單元: PDFium
當鍵盤產生可輸入字元時,會針對每個字元觸發一次

Syntax

property OnKeyPress: TKeyPressEvent;

Description

Fired for each character generated by the keyboard. The Sender parameter references the TPdfView instance that raised the event, so a single handler can serve multiple views by inspecting Sender.

Typical uses include: filter or transform typed characters before they reach text-selection or form-field handlers. Because the handler runs on the VCL main thread, you can update form controls and call other VCL APIs directly.

Handlers must return quickly — PDFium rendering and form filling occur on the same thread, and any delay here postpones the next page repaint.

Remarks

Example

procedure TForm1.PdfViewOnKeyPress(Sender: TObject; var Key: Char);
begin
  // filter or transform typed characters before they reach text-selection or form-field handlers
  Caption := Format('OnKeyPress on page %d', [PdfView1.PageNumber]);
end;

See Also

OnClick, OnPageChange, OnMouseDown, PageNumber