Hallo,
ist da nicht ein Denkfehler drin?
Delphi-Quellcode:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key =#27 then caption:='esc'; // OK
if key = Ord('c') then caption:='Taste C'; // Passiert nichts
if key =#43 then caption:='Taste C'; // auch nichts
end;
Müsste es nicht etwa so aussehen?
Delphi-Quellcode:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
Case Key of
#27 : caption := 'esc'; // OK
'c' : caption := 'Taste c'; // OK
'C' : caption := 'Taste C'; // OK
end;
end;
Key ist bereits das Zeichen und muss nicht mit Ord "übersetzt" werden, bei KeyDown und KeyUp bekommt man jedoch Key als Word geliefert.