Autor Beitrag
freak89
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 06.03.05 22:35 
Auf Tasten die mit Buchstaben belegt sind kann ich ja einfach mit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = 'a' ) and (form1.color = clBtnface)
 then form1.Color := clwhite;
end;

zugreifen. Aber wie kann ich z.b. dieses Ereignis auf eine der Pfeiltasten legen?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 06.03.05 22:38 
VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 06.03.05 22:45 
beim keypress also if key = chr(vk_left) then

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
freak89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 06.03.05 23:01 
hmm so ging es bei mir nciht, du hast mich aber trotzdem auf die richtige lösung gebracht:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if chr(Key) = chr(vk_left)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 06.03.05 23:20 
beim keydown kannst du auf die chr-konvertierung verzichten ^^
if key = vk_left then

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: So 06.03.05 23:21 
Du verwendest ja auch das onkeydown, retnyg schrieb doch das sein code fürs onkeypress geeignet ist, wo ein char verlangt wird.
Im Onkeydown ein Wert vom Typ Word, also kannst du den Cast in Char auch weglassen.
Auch wenns nicht so aussieht, aber vk_left ist schon ein Word, vk_left is irgendein konstanter Wert.