+ Added examples 4 to 7

This commit is contained in:
michael 2001-09-12 22:39:49 +00:00
parent 3b9df162d1
commit b41cfaef2b
6 changed files with 114 additions and 2 deletions

View File

@ -32,8 +32,8 @@ endif
.PHONY: all tex clean
OBJECTS=ex1 ex2 ex3
# ex4 ex5 ex6 ex7 ex8 ex9 \
OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7
# ex8 ex9 \
# ex10 ex11 ex12 ex13 ex14 ex15 ex16 ex17 ex18
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))

View File

@ -5,3 +5,7 @@ keybutil.pp contains some routines to convert keyevents to readable strings.
ex1.pp contains an example of the GetKeyEvent function.
ex2.pp contains an example of the GetKeyEventCode function.
ex3.pp contains an example of the GetKeyEventShiftState function.
ex4.pp contains an example of the PollKeyEvent function.
ex5.pp contains an example of the PutKeyEvent function.
ex6.pp contains an example of the PollShiftStateEvent function.
ex7.pp contains an example of the IsFunctionKey function.

26
docs/kbdex/ex4.pp Normal file
View File

@ -0,0 +1,26 @@
program example4;
{ This program demonstrates the PollKeyEvent function }
uses keyboard, keybutil;
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.

33
docs/kbdex/ex5.pp Normal file
View File

@ -0,0 +1,33 @@
program example5;
{ This program demonstrates the PutKeyEvent function }
uses keyboard, keybutil;
Var
K,k2 : TKeyEvent;
begin
InitKeyBoard;
Writeln('Press keys, press "q" to end.');
K2:=0;
Repeat
K:=GetKeyEvent;
If k<>0 then
begin
if (k2 mod 2)=0 then
K2:=K+1
else
K2:=0;
K:=TranslateKeyEvent(K);
Writeln('Got key : ',KeyEventToString(K));
if (K2<>0) then
begin
PutKeyEvent(k2);
K2:=TranslateKeyEVent(K2);
Writeln('Put key : ',KeyEventToString(K2))
end
end
Until (GetKeyEventChar(K)='q');
DoneKeyBoard;
end.

27
docs/kbdex/ex6.pp Normal file
View File

@ -0,0 +1,27 @@
program example6;
{ This program demonstrates the PollShiftStateEvent function }
uses keyboard, keybutil;
Var
K : TKeyEvent;
begin
InitKeyBoard;
Writeln('Press keys, press "q" to end.');
Repeat
K:=PollKeyEvent;
If k<>0 then
begin
K:=PollShiftStateEvent;
Writeln('Got shift state : ',ShiftStateToString(K,False));
// Consume the key.
K:=GetKeyEvent;
K:=TranslateKeyEvent(K);
end
{ else
write('.')};
Until (GetKeyEventChar(K)='q');
DoneKeyBoard;
end.

22
docs/kbdex/ex7.pp Normal file
View File

@ -0,0 +1,22 @@
program example1;
{ This program demonstrates the GetKeyEvent function }
uses keyboard, keybutil;
Var
K : TKeyEvent;
begin
InitKeyBoard;
Writeln('Press keys, press "q" to end.');
Repeat
K:=GetKeyEvent;
K:=TranslateKeyEvent(K);
If IsFunctionKey(K) then
Writeln('Got function key : ',KeyEventToString(K))
else
Writeln('not a function key.');
Until (GetKeyEventChar(K)='q');
DoneKeyBoard;
end.