Hello Pascal masters...
Long story short, I'm converting a huge legacy application written in TP 5.5 over to FPC. I'm in need of a routine that works exactly like ReadKey in the standard FPC CRT unit, but returns Word instead of Char. If ALT or function keys are pressed, I need the routine to set the "Lo" portion of ReadKeyWord to zero and putting the value in the "Hi" portion.
I'm trying to satisfy the following legacy code from my app:
work:=readkeyword;
if lo(work)=0 then
begin
ch:=chr(hi(work));
if ord(ch) in [16..50] then
altkv:=ord(ch);
if (*editmode and *) (ord(ch) in [94..103,104..113]) then
begin
if ord(ch) in [94..103] then
mn:=ord(ch)-83
else
mn:=ord(ch)-103;
current_macro:=macros[mn];
macro_pos:=1;
if current_macro<>nil then
inc:=inc
else
inc:=chr(0)
end
else
if ord(ch)<128 then
inc:=chr(ord(ch)+128)
else
inc:=chr(0);
end
else
inc:=chr(lo(work));
end