Board index » delphi » Beep when press Enter key. HELP

Beep when press Enter key. HELP

How can I disable default beep tone when I press Enter key while Edit field
has the focus?
(My forms don't have default buttons.)

 (I don't want to disable the Default Beep option in the control panel /
sounds)

 

Re:Beep when press Enter key. HELP


Quote
"Robert" <rlakin...@hotmail.com> wrote in message news:3b972ec0_1@dnews...
> How can I disable default beep tone when I press Enter key while Edit
field
> has the focus?
> (My forms don't have default buttons.)

>  (I don't want to disable the Default Beep option in the control panel /
> sounds)

put

Key := #0;

into the edit's OnKeyPress event.

--
A day without sunshine is like, you know, night.

ICQ: 91418899
http://www.planeted.co.uk
http://www.eduffe.freeserve.co.uk

Re:Beep when press Enter key. HELP


Robert,

Try this code:

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

--
Prolix Webmaster
http://www.prolix.be
The best newsgroup archive available

Quote
"Robert" <rlakin...@hotmail.com> wrote in message news:3b972ec0_1@dnews...
> How can I disable default beep tone when I press Enter key while Edit
field
> has the focus?
> (My forms don't have default buttons.)

>  (I don't want to disable the Default Beep option in the control panel /
> sounds)

Re:Beep when press Enter key. HELP


It may be as simple as handling the keypress itself.  I had the same problem
in my program.  Try adding an OnKeyUp event to the form, and also an
OnKeyPress event to handle the complete key presses.  Windows doesn't like
it if you handle Key down and not Key Up

Quote
Robert <rlakin...@hotmail.com> wrote in message news:3b972ec0_1@dnews...
> How can I disable default beep tone when I press Enter key while Edit
field
> has the focus?
> (My forms don't have default buttons.)

>  (I don't want to disable the Default Beep option in the control panel /
> sounds)

Re:Beep when press Enter key. HELP


Thanks,
  Robert

Quote
"Robert" <rlakin...@hotmail.com> wrote in message news:3b972ec0_1@dnews...
> How can I disable default beep tone when I press Enter key while Edit
field
> has the focus?
> (My forms don't have default buttons.)

>  (I don't want to disable the Default Beep option in the control panel /
> sounds)

Other Threads