mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 04:22:07 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			636 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			636 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
program example1;
 | 
						|
 | 
						|
{ This program demonstrates the GetKeyEvent function }
 | 
						|
 | 
						|
uses keyboard;
 | 
						|
 | 
						|
Var
 | 
						|
  K : TKeyEvent;
 | 
						|
 | 
						|
begin
 | 
						|
  InitKeyBoard;
 | 
						|
  Writeln('Press keys, press "q" to end.');
 | 
						|
  Repeat
 | 
						|
    K:=GetKeyEvent;
 | 
						|
    Write('Got key event with ');
 | 
						|
    Case GetKeyEventFlags(K) of
 | 
						|
      kbASCII    : Writeln('ASCII key');
 | 
						|
      kbUniCode  : Writeln('Unicode key');
 | 
						|
      kbFnKey    : Writeln('Function key');
 | 
						|
      kbPhys     : Writeln('Physical key');
 | 
						|
      kbReleased : Writeln('Released key event');
 | 
						|
    end;
 | 
						|
    K:=TranslateKeyEvent(K);
 | 
						|
    Writeln('Got key : ',KeyEventToString(K));
 | 
						|
  Until (GetKeyEventChar(K)='q');
 | 
						|
  DoneKeyBoard;
 | 
						|
end.
 |