PDFiumVCL Docs

OnKeyUp event

Component: TPdfView  ·  Unit: PDFium
Occurs when a key is released while the viewer control has focus.

Syntax

property OnKeyUp: TKeyEvent;

Description

OnKeyUp is the standard VCL keyboard event published on TPdfView. The handler runs after the operating system reports a WM_KEYUP / WM_SYSKEYUP message while the control has focus. The event signature is procedure(Sender: TObject; var Key: Word; Shift: TShiftState)Key is the virtual-key code (VK_ESCAPE, VK_NEXT, VK_PRIOR, …) and Shift reports modifier state at the moment of release.

OnKeyUp fires for every key — including non-character keys such as arrow keys and function keys — provided TPdfView has keyboard focus. Set Key to zero inside the handler to consume the event so it does not propagate further (for example to block Tab from cycling focus when a form field is being edited).

Use OnKeyUp to implement viewer shortcuts that should fire on release rather than hold — Page Down / Page Up for navigation, F3 for search-next, Escape to dismiss a selection. Continuous interactions (panning, marquee selection) are better driven from OnKeyDown because the OS auto-repeats KeyDown but only emits one KeyUp per physical release.

Remarks

Example

procedure TForm1.PdfView1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  case Key of
    VK_NEXT:  PdfView1.PageNumber := PdfView1.PageNumber + 1;
    VK_PRIOR: PdfView1.PageNumber := PdfView1.PageNumber - 1;
    VK_HOME:  PdfView1.PageNumber := 1;
    VK_END:  PdfView1.PageNumber := Pdf1.PageCount;
    VK_ESCAPE: PdfView1.ClearHighlight;
  end;
end;

See Also

OnKeyDown, OnKeyPress, PageNumber, ClearHighlight