Board index » delphi » TEdit: Annoying Beeps on enter keypress

TEdit: Annoying Beeps on enter keypress

When I press the return key on a TEdit Component there is a beep, does
anyone know a way to prevent this from happening?  (The code that
executes the beep does not appear in the VCL source code)

Thanks,

Conall Keogh
cke...@iol.ie

I

 

Re:TEdit: Annoying Beeps on enter keypress


Hi, Conall!

You have to write a handler for the OnKeyPress event; in that
handler, test for the Enter key - if that's the key, set it to
#0 to tell Delphi you handled it already...

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
      Key := #0;
  inherited KeyPress(Sender, Key);
end;

HTH

Ken
--
kwh...@westelcom.com
qpwpla...@aol.com

Clipper Functions 3.0 for Delphi
http://members.aol.com/clipfunc

Quote
Conall Keogh wrote:

> When I press the return key on a TEdit Component there is a beep, does
> anyone know a way to prevent this from happening?  (The code that
> executes the beep does not appear in the VCL source code)

> Thanks,

> Conall Keogh
> cke...@iol.ie

> I

Other Threads