Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Codes für KeyPress Ctrl shift delete Pfeil (https://www.delphipraxis.net/127923-codes-fuer-keypress-ctrl-shift-delete-pfeil.html)

nahpets 21. Jan 2009 14:40

Re: Codes für KeyPress Ctrl shift delete Pfeil
 
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.


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:05 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz