ptccrtkeys.pas 678 B

12345678910111213141516171819202122232425262728293031323334
  1. program ptccrtkeys;
  2. uses
  3. {$ifdef UNIX}cthreads,{$endif UNIX}
  4. ptccrt, ptcgraph;
  5. var
  6. Gd, Gm: Integer;
  7. Ch, Ex: AnsiChar;
  8. Done: Boolean;
  9. begin
  10. Gd := VGA;
  11. Gm := VGAHi;
  12. InitGraph(Gd, Gm, '');
  13. Writeln('startup KeyMode (press ''m'' to switch): ', KeyMode);
  14. Done := False;
  15. repeat
  16. Ch := ReadKey;
  17. if Ch = #0 then
  18. Ex := ReadKey
  19. else
  20. Ex := #0;
  21. Writeln(Ord(Ch), ' ', Ord(Ex));
  22. if Ch = 'm' then
  23. begin
  24. if KeyMode <> High(KeyMode) then
  25. KeyMode := Succ(KeyMode)
  26. else
  27. KeyMode := Low(KeyMode);
  28. Writeln('KeyMode: ', KeyMode);
  29. end;
  30. if Ch = 'q' then
  31. Done := True;
  32. until Done;
  33. CloseGraph;
  34. end.