Link to home
Start Free TrialLog in
Avatar of John86a
John86a

asked on

Delphi 7 - How can I make the <enter> key on a button ?

Basically the button needs to act like enter key on this particular Memo, is that possible?
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

this way
procedure TForm3.Button1Click(Sender: TObject);
begin
  Memo1.SetFocus;
  Keybd_Event(VK_RETURN,   1, 0, 0);
end;

Open in new window


Modify this to
procedure TForm3.Button1Click(Sender: TObject);
begin
  Memo1.SetFocus;
  Keybd_Event(VK_RETURN, 1, 0, 0);
  Keybd_Event(VK_RETURN, 1, KEYEVENTF_KEYUP, 0);
end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John86a
John86a

ASKER

That helped me track where my application was replacing <Enter> for <Tab> thank you.