PDFium Component Docs

OnKeyUp event

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

Syntax

property OnKeyUp: TKeyEvent;

Description

OnKeyUp is the standard VCL keyboard event exposed by TPdfView. The handler runs after Windows reports a WM_KEYUP / WM_SYSKEYUP message while the control has focus. Its 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 point of release

OnKeyUp fires for every key — including non-character keys such as arrow keys and function keys — as long as TPdfView has keyboard focus. Set Key to zero inside the handler to consume the event so that it does not propagate further, for example to stop Tab moving focus while a form field is being edited

Use OnKeyUp for viewer shortcuts that should run on release rather than while a key is held — Page Down / Page Up for navigation, F3 for search-next, Escape to dismiss a selection. Continuous interactions such as panning or marquee selection are better driven from OnKeyDown because the OS repeats KeyDown but emits only one KeyUp for each 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