Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-09

WinCRT vs CRT

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

James Richters

I am working on a console application that uses the graph unit. I want my graphics window to be the one that accepts keyboard input, I found out that if I just change to 'WinCRT' instead of 'CRT' it does exactly this. however there is a problem with WinCRT that I do not understand. Please reference my test program:

Program KeyTestWin.pas;
Uses Graph,
//     CRT;
     WinCRT;
Var
   Test:Char;
   GD,GM:Integer;
Begin
   gd:=detect;
   gm:=0;
   Initgraph(gd,gm,'');
   repeat
      Test:=readkey;
      if TestChr(0) then
         Writeln ('KeyCode: ',Ord(Test))
      Else
         begin
            Test := Readkey;
            Writeln ('Extended: ',Ord(Test));
         end;
   Until Test=Chr(27);
End.

If I comment out WinCRT and uncomment CRT and run it, then I get almost the full keyboard, for example

ALT-X = Extended: 45

CTRL *= Extended: 150

CTRL 8 = Extended: 9

F10 = Extended: 68

CRTL F10 = Extended: 103

ALT F10 = Extended: 113

I do notice just a few keys that windows intercepts, like F11 makes it full screen and my application never sees the keystroke, but actually very few keys are intercepted by windows like this.

But with WinCRT instead of CRT, None of these and many more report anything at all.. it's as if I didn't even hit a key.

NONE of the keys wit ALT respond at all

CTRL works with most Letters but NO number

F10, F11, and F12 do not work.. etc. etc. etc.. you get the idea, it's extremely limited.

Does anyone have any idea why this is happening or if there is another way to get keyboard input on the graph window and be able to use the entire keyboard?

Any help is greatly appreciated!

James

Reply by email