PDFium Component Docs

OnClick-tapahtuma

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 stjaard OnMouseDown / OnMouseUp sequence whenever the user presses ja 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 ja translated with ScreenToClient.

The viewer's internal click hjaling for annotations, web links ja 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 ja 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