[fpc-pascal]Keyboard unit questions

Alan Mead cubrewer at yahoo.com
Fri Sep 10 17:33:21 CEST 2004


I just used the keyboard unit for the first time and it's quite
impressive but I have some questions.

Initially, I couldn't link on my old RH 7.2 machine because FPC 1.9.4
couldn't find the GPM libraries.  This is probably a stupid question
but is there a way that FPC can find libraries better so that I don't
have to ln -s /usr/libgpm.so.1 to /usr/libgpm.so?  This has happened
with other FPC units...

Anyway, isn't GPM a mouse package?!? I didn't consult the unit's
source but I don't see any mouse functionality in the docs? Just
curious.

And finally, I pasted my little example program below.  When I run it
in Konsole and it has some funny behavior.  Like Shift-F2 is reported
as F4 and Control-U is reported as 'SHIFT' ^A and ^E don't seem to
have any text associated with them (maybe it's reporting a space?). 
I wanted to build a simple bash-like command history/editing and I
was going to use those but if I cannot read them...

In xterm it's slightly different... for example, ^A does nothing but
then the next charcter shows as SHIFT x (e.g., ^Aa shows as 'SHIFT
a') and Shift-F2 shows three keys.. 'Key with scancode 6144', 2, and
Q while Shift-F3 shows the same scancode and then 2,R.

I tried adding the shift state but that didn't change anything and
the shift states don't seem to be read accuractely (control and alt
are never read).

Thanks!

-Alan

program readline;

uses keyboard;

  procedure ReadKBD(var S: String);
    var K : TkeyEvent;
    begin
      InitKeyboard;
      Repeat
        K:=GetKeyEvent;
        K:=TranslateKeyEvent(K);
        writeln(KeyEventToString(K));
      Until (GetKeyEventChar(K)='q');
      DoneKeyboard;
    end;

var S:String;
begin
  ReadKBD(S);
end.


-Alan




More information about the fpc-pascal mailing list