PDFiumVCL 文档

OnClick event

此 API 条目保留标识符、签名、代码块和 PDF 术语的原始形式。
Component: TPdfView  ·  Unit: PDFium
Occurs when the user clicks (left mouse button) inside the viewer.

Syntax

property OnClick: TNotifyEvent; // published, inherited from TControl

Description

OnClick fires after the standard OnMouseDown / OnMouseUp sequence whenever the user presses and releases the left mouse button without moving the cursor far enough to register as a drag. The Sender parameter is the TPdfView instance itself; the cursor position is not passed, but it can be retrieved from Mouse.CursorPos and translated with ScreenToClient.

The viewer's internal click handling for annotations, web links and form fields runs before this event — if the click hit a navigable link the page jump or URI launch has already happened. OnClick is therefore most useful for application-level reactions: dismissing a tool-tip overlay, hiding a thumbnail panel, recording an analytics event, or toggling a focus mode.

If a granular position is needed, hook OnMouseDown or OnMouseUp instead. To detect clicks on specific PDF objects (annotations, links, form fields), use the dedicated events OnAnnotationLinkClick and OnWebLinkClick, or call HasFormFieldAt from OnMouseDown.

Remarks

Example

// Dismiss an overlay panel whenever the user clicks the document
procedure TForm1.PdfView1Click(Sender: TObject);
begin
  if SearchPanel.Visible then
    SearchPanel.Hide;
  StatusBar1.SimpleText := Format('Clicked — page %d of %d',
    [PdfView1.PageNumber, PdfView1.Pdf.PageCount]);
end;

See Also

OnDblClick, OnMouseUp, OnAnnotationLinkClick, OnWebLinkClick