mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 12:59:29 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			448 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			448 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
program example4;
 | 
						|
 | 
						|
{ This program demonstrates the PollKeyEvent function }
 | 
						|
 | 
						|
uses keyboard;
 | 
						|
 | 
						|
Var
 | 
						|
  K : TKeyEvent;
 | 
						|
 | 
						|
begin
 | 
						|
  InitKeyBoard;
 | 
						|
  Writeln('Press keys, press "q" to end.');
 | 
						|
  Repeat
 | 
						|
    K:=PollKeyEvent;
 | 
						|
    If k<>0 then
 | 
						|
      begin
 | 
						|
      K:=GetKeyEvent;
 | 
						|
      K:=TranslateKeyEvent(K);
 | 
						|
      writeln;
 | 
						|
      Writeln('Got key : ',KeyEventToString(K));
 | 
						|
      end
 | 
						|
    else
 | 
						|
      write('.');
 | 
						|
  Until (GetKeyEventChar(K)='q');
 | 
						|
  DoneKeyBoard;
 | 
						|
end.
 |