Board index » delphi » TMemo, silence Return/Enter/etc...

TMemo, silence Return/Enter/etc...

Hi,

Can someone tell me how to stop the beeping that edit controls make when
they receive keys like Enter, Return, etc.

Okorie

 

Re:TMemo, silence Return/Enter/etc...


On Tue, 21 Nov 2000 14:14:03 -0000, "Okorie" <Okori...@hotmail.com>
wrote:

Quote
>Can someone tell me how to stop the beeping that edit controls make when
>they receive keys like Enter, Return, etc.

Microsoft Windows (not Delphi) beeps when a keystroke isn't handled.
If you really want your application to work differently than other
Windows applications when Enter/Return is pressed, then you'll need to
pretend that you're handling the key, even when you aren't. To
indicate you've handled a key, return zero from one of the OnKeyXXX
events. Here's an example:

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then Key := #0;
end;
--
Rick Rogers (TeamB); Fenestra Technologies, http://www.fenestra.com/
  Use Borland servers; posts via others are not seen by TeamB.
  For more info, see http://www.borland.com/newsgroups/genl_faqs.html

Re:TMemo, silence Return/Enter/etc...


Thanks very much,

Okorie

Other Threads