[Lazarus] RE : read single char from STDIN

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Sat Nov 19 12:09:12 CET 2011

Ludo Brands wrote:
>>      ke := GetKeyEvent;
>>      kr := TKeyRecord(ke);
> The cast to TKeyRecord is wrong. You should use GetKeyEventFlags,
> GetKeyEventCode, GetKeyEventShiftState, etc to get the individual parts.
> They do fe. a (KeyEvent and $00FF0000) shr 16;  which is endian safe.

Thanks Ludo, I was anticipating that but this was the result of a 
quick-and-dirty late-night experiment which relied on 
being correct: it explicitly says a typecast should work.

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the Lazarus mailing list