Board index » delphi » Beeping when <ENTER> is pressed

Beeping when <ENTER> is pressed

I've been using the following code to make the <ENTER> key behave like
the <TAB> key to advance the cursor to the subsequent fields.  

procedure TForm1.EditKeyPress(Sender: TObject; var Key:Char);
begin
  if Key = Chr(VK_RETURN) then
    Perform(WM_NEXTDLGCTL,0,0);
end;

This works great but I want to get rid of the Beep that goes off every
time the <ENTER> key is presse.  Any ideas?  Thanks!

-Tino Tran

 

Re:Beeping when <ENTER> is pressed


Tino,

Change the code to:

procedure TForm1.EditKeyPress(Sender: TObject; var Key:Char);
begin
if Key = Chr(VK_RETURN) then
        begin
        Perform(WM_NEXTDLGCTL,0,0);
        key:= #0;
        end;
end;
--
Paul, SoftStuff, Fri, 16th August, 1996, 13:49 EST
pa...@linuxserver.pccity.com.au
Croydon, Australia, 3136.

Tino Tran <tinot...@owlnet.rice.edu> wrote in article
<3213587C.6...@owlnet.rice.edu>...

Quote
> I've been using the following code to make the <ENTER> key behave like
> the <TAB> key to advance the cursor to the subsequent fields.  

> procedure TForm1.EditKeyPress(Sender: TObject; var Key:Char);
> begin
>   if Key = Chr(VK_RETURN) then
>     Perform(WM_NEXTDLGCTL,0,0);
> end;

> This works great but I want to get rid of the Beep that goes off every
> time the <ENTER> key is presse.  Any ideas?  Thanks!

> -Tino Tran

Other Threads