API referenceRendering & Viewer

rasKeyStroke

Keyboard input for the viewer — real, narrow behavior:

C
TPDFCursor __stdcall rasKeyStroke(IPGC CachePtr, BOOL32 Down, uint32_t CharCode, uint32_t ShiftState);
Delphi
function rasKeyStroke(CachePtr: IPGC; Down: LongBool; CharCode, ShiftState: Cardinal): TPDFCursor; stdcall;

Purpose. Keyboard input for the viewer — real, narrow behavior: Esc clears the current selection; Ctrl+A marquee-selects the whole current page.

Description. Acts only on key-down (if not Down then Exit) — key-up events are accepted but always no-op. Recognizes exactly two key combinations by hardcoded virtual-key/shift-mask constants (KEY_ESC = 27, KEY_A = 65, SS_CTRL = $04): Esc clears HasSel/Dragging/the cached selected-text buffer; Ctrl+A calls SelectWholePage(C) to select the entire current page as a device rect matching the page's own on-screen placement. No other key is handled — there is no text-input, arrow-key-scroll, or page-navigation keyboard handling anywhere in this function.

Parameters.

ParameterDescription
CachePtrTarget page cache.
DownFalse (key-up) is always a no-op.
CharCodeOnly 27 (Esc) and 65 (A, with Ctrl) have any effect.
ShiftStateOnly bit $04 (Ctrl) is checked, and only in combination with CharCode = 65.

Return value. pcrArrow1 in all cases (including the two recognized key combinations — no cursor-shape change results from either).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern TPDFCursor rasKeyStroke(IntPtr CachePtr, [MarshalAs(UnmanagedType.Bool)] bool Down, uint CharCode, uint ShiftState);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasKeyStroke

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.