PDFium Delphi Component Docs

OnClick event

Component: TPdfView  ·  Unit: PDFium
Fires when the user clicks with the left mouse button inside the viewer

Syntax

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

Description

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

The viewer's internal click handling for annotations, web links and form fields runs before this event, so 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 tooltip overlay, hiding a thumbnail pane, recording an analytics event, or toggling a focus mode

If you need a more precise position, hook OnMouseDown or OnMouseUp instead. To detect clicks on specific PDF objects such as annotations, links or 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