Board index » delphi » How to detect if cursor keys are pressed?

How to detect if cursor keys are pressed?

Hi,

In my Delphi 3 program I want to use the cursor keys from the separated
block.
But the cursor keys don't generate a on-key-down Event. Any other
key-pressed gives a result.

Can anyone help us with this problem?

Marco

 

Re:How to detect if cursor keys are pressed?


Working with D4 :

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    procedure FormActivate(Sender: TObject);
    procedure DoMessages ( var Msg : tMsg; var Handled :
Boolean );

procedure TForm1.FormActivate(Sender: TObject);
begin
   Application.OnMessage := DoMessages;
end;

procedure TForm1.DoMessages ( var Msg : tMsg; var Handled :
Boolean );
begin
  if ( Msg.wParam In [VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT] )
Then
  begin
    Case Msg.wParam Of
      VK_UP : Edit1.Text := 'Key UP';
      VK_DOWN : Edit1.Text := 'Key DOWN';
      VK_LEFT : Edit1.Text := 'Key Left';
      VK_RIGHT : Edit1.Text := 'Key RIGHT';
    end;
    Handled := true;
  End;
end;

Hope this will help you

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

Other Threads