• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Use ENTER in a TEdit box!

How to make the ENTER an event in a TEdit box?
I have now used the Button1Click in a button, but it si a bit bothersome.
0
liljen_80
Asked:
liljen_80
1 Solution
 
mikelittlewoodCommented:
Use the OnKeyPress event of the edit box to do something when the ENTER key is pressed.
Is this what you mean?

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    // DO SOMETHING
  end;
end;
0
 
BlackTigerXCommented:
in addition to that...

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    Key:=#0; //"eat" the key, so it doesn't beep
    // DO SOMETHING
  end;
end;
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now