Is it possible to detect
shift left
shift right
shift up
shift dn
shift pgup
shift pgdn
shift home
shift end
e.g. in a texteditor these are used for selecting text.
The keyboard generates an interrupt, so the keystroke can be detected
with keypressed, but the value returned by readkey is the same as for the
keys without the shift.
The same for the FAQ 78 solution for detecting F11 and F12. (BTW. This
procedure lacks a keypressed check)
Of course it is possible to poll the keyboard and look for one of the
shift keys. (see the example program below). But the danger is that the
shift state is missed by the poll if there is a time consuming procedure
in the loop. OTH I noticed that upon de-pressing the arrow, pgup/dn
home/end key, a shift down key scan is generated again if shift remains
down.
--
Femme
PS The code for checking the keyscan is.
uses crt;
const ch:char=#1;
var key:byte;
begin
repeat
if keypressed then
begin
gotoxy(1,1); clreol;
ch:= readkey;
if ch=#0 then
begin write('Extended ');
ch:=readkey
end;
write('Char(',ord(ch),')="',ch,'" ');
end;
if port[$60]<>key then
begin
gotoxy(1,3); clreol;
key:=port[$60];
if (key and $80) = $80
then write('key(',key and $7f,') up ')
else write('key(',key and $7f,') down ')
end;
until ch=#27;
end.