Board index » delphi » TEdit beeps when i press Enter down

TEdit beeps when i press Enter down

I place a TEdit component in the form, its OnKeyDown event handler
likes:
  procedure TfrmMain.edtKeywordKeyDown(Sender: TObject; var Key: Word;
    Shift: TShiftState);
  begin
    if Key = VK_RETURN then
      btnSearchClick(Self);
  end;
when i run the program, i hear a beep when i press Enter...
anybody knows how to avoid the beep?

 

Re:TEdit beeps when i press Enter down


Quote
"Joseph Lin" <nauss...@kimo.com.tw> wrote in message

news:397bb8cf$1_1@dnews...

Quote

> when i run the program, i hear a beep when i press Enter...
> anybody knows how to avoid the beep?

Add an OnKeyPress event as well.....

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

Ian

Re:TEdit beeps when i press Enter down


On 23 Jul 2000 20:32:31 -0800, "Joseph Lin" <nauss...@kimo.com.tw>
wrote:

Quote
>TEdit beeps

Ian has given you the solution. You should also understand, however,
that it isn't the Delphi TEdit component that beeps, as you
incorrectly stated in your question. Rather, it is Microsoft Windows
that beeps, when a keystroke isn't handled by anything.
--
Rick Rogers (TeamB)
www.fenestra.com and www.componentfactory.com

Other Threads