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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hubdogCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.