## using the arrow keys

Please discuss general Delphi programming topics here.

### using the arrow keys

Hello,
Im very new to delphi programming..
I had moderate experience with turbo pascal in my high school days, but nothing extreme.

Im trying to run my RC car through my computer.. any how i want to use the Arrow keys. Ive got to the point where I can detect keydown VK_UP (VK_DOWN ect) but i have to hold the ALT key for it to work...
Also I want to be able to detect if 2 keys are pressed (ie UP AND LEFT) heres what ive got so far:

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case key of
VK_LEFT: label1.Caption := 'This is Left Key';
VK_UP : label1.Caption := 'This is the up key';
end;
end;
stowaway
Member

Posts: 1
Joined: March 9th, 2009, 10:49 am

### Re: using the arrow keys

You may want to consider using this function inside a timer.

Code: Select all
function IsKeyDown(VirtualKey: Integer): Boolean;begin  Result := WordBool(GetKeyState(VirtualKey) and \$8000);end;
Kambiz

Kambiz