RETURN-key in TEdit

I have a TEdit Component with my own OnKeyDown Event.
Whenever I press the Return-Key, I get a Beep. That's probably because TEdit is a one-line Edit Component.

Does anybody know how to prevent the f@%&ing beep ?

Regards, Oli
LVL 1
Oli2Asked:
Who is Participating?
 
hubdogConnect With a Mentor Commented:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if key=vk_return then
  begin
    //do what you want
    key=#0;
  end;
end;

good luck

hubdog
0
 
intheCommented:
haha beat me :-)

another way but rather similar :

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #13) then
Key:= #0;
end;
0
 
intheCommented:
ps
 Oli2 please do not accept my comment as answer , its hubdogs turn for some points :-)
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
Oli2Author Commented:
unbeliveable !! it's that cheap ??
It does work. Well, as long as I don't do an Application.ProcessMessages as the first thing in the OnKeyDown Event, huh? Well, I don't, so your answer works fine for me.

Okayl, hubdog, come on and get your points... :-)

Regards, Oli
0
 
Oli2Author Commented:
just saw the "accept comment as an answer".
That's new !  Haven't been here for a while...
0
 
hubdogCommented:
hi inthe
this time i quicker than you
haha:-{)))))
0
All Courses

From novice to tech pro — start learning today.