Autor Beitrag
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Di 25.12.07 01:35 
N'abend!

Kann mir einer erklären, warum die virtual keys im OnKeyPress-Ereigniss der Form nicht so richtig wollen?

Bsp.:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
  // geht nicht:
  if key = char(VK_LEFT) then ShowMessage('Links');
  // geht:
  if key = char(VK_ESCAPE) then ShowMessage('Escape');
end;

Bräuchte gerade die Cursor-Tasten, aber es will einfach nicht...

[EDIT]Hat sich erledigt OnKeyPress braucht wohl echte ASCII-Werte und unterstützt keine virtuellen Keys; anders OnKeyDown[/EDIT]

Gruß

Calculon
--

_________________
Hallo Mutti
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Di 25.12.07 02:03 
Den genauen Grund kann ich Dir jetzt auch nicht nennen.

Sofern vom Programmhandling her möglich:
--> Nimm KeyUp statt KeyPress

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Di 25.12.07 05:37 
Da war doch mal was. :lupe: Ah ja : www.delphipraxis.net...funktionstasten.html

_________________
Gruß
Hansa