[fpc-pascal]Keyboard unit questions

John Coppens john at jcoppens.com
Fri Sep 10 19:50:54 CEST 2004


On Fri, 10 Sep 2004 08:33:21 -0700 (PDT)
Alan Mead <cubrewer at yahoo.com> wrote:

> 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...

Hi Alan.

Surely someone with more experience will correct me. But for starters:

libgpm.so.1 shouldn't be in /usr - it should be either in usr/lib or
usr/local/lib. In that case, your machine will automatically do the link,
when it executes ldconfig.

> 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.

GPM is a combination of both - it permits using the mouse to 'paint' parts
of text screens and past them as if someone is typing - so it does have
something to mouse _and_ keyboard.

> 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...

Can't help you there. 

John

> 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
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list