[fpc-pascal] Keyboard unit under Linux
Michalis Kamburelis
michalis.kambi at gmail.com
Thu Oct 18 01:20:31 CEST 2007
Frank McCormick wrote:
> Resending because of some changes in my results.
>
>
> I am having a tough time using the keyboard unit under Linux. Please tell me
> whats wrong with this code:
>
> ( var section cut out)
>
> Begin
> InitKeyBoard;
> Repeat
> K:=pollKeyEvent;
> if k <>0
> then
> begin
> k:=getkeyevent;
> k:=translatekeyevent(k);
> if isfunctionkey(k)
> then
> case k Of
Replace above line with "case GetKeyEventCode(k) Of". To compare with
constants like kbdF1 and such, you have to extract event code from
TKeyEvent value by GetKeyEventCode (somewhat analogous to
GetKeyEventChar that you use below).
> kbdF1 :
> Begin
> End;
> kbdF3 : ;//DoSpot;
> kbdF4 : ;//DoId;
> kbdF2 :Begin
> End;
> kbdF9 : ;//GetUpdate(PromoString,PromoPrompt);
> kbdF10 :;// GetUpdate(WeatherString,WeatherPrompt);
> end
> else if not isfunctionkey(k)
> then
> case getkeyeventchar(k) of
> '1'..'8' :
> Begin
> End;
> 'c':
> Begin
> End;
> 'd':
> Begin
> End;
> 'N','n': GetNext;
> End; {of case}
> End;
> Until quit;
> End;
>
> I have chopped out a lot of the code; The only keys I get or those in the
> getkeyeventchar section, i.e. '1'..'8' etc.
>
>
> Cheers
>
> Frank
>
More information about the fpc-pascal
mailing list