function getKey : Smallint;
var ch : Byte;
begin
if keypressed then begin
ch := Ord(readKey);
if ch = 0 then getKey := 1000 + Ord(readKey)
else getKey := ch;
end else getKey := -1;
End;
Pretty smart. I found it online and it works great. Returns -1 if no key pressed. and 1000+scancode or ascii value. It really helps clean up the main program alot!
Bookmarks