Board index » cppbuilder » TEdit - Edit Box makes ding sound

TEdit - Edit Box makes ding sound

When pressing the Enter key in a EditBox it makes a ding sound. How do you
turn it off.
 

Re:TEdit - Edit Box makes ding sound


Quote
>When pressing the Enter key in a EditBox it makes a ding sound. How do you
>turn it off.

That 'ding' is Window's way of saying it can't do anything with the Enter
key-press.  2 options - turn off the sound in the control panel applet, or
capture the key-press before Window's gets ahold of it, and if the key is
<Enter>, throw it away (are change to a tab?).
Dave Curry

Re:TEdit - Edit Box makes ding sound


Quote
> void __fastcall TFrCueGastos::Ed1KeyPress(TObject *Sender, char &Key)
> {
> if (Key == 13)
>    {
>    Key = 0;
>    Perform(WM_NEXTDLGCTL, 0, 0);
>    }
> }

I prefer this:

 if ( Key == VK_RETURN )
 {
  Key = 0;
  SelectNext( static_cast<TWinControl*>(Sender), true, true );
 }

It use the windows define so it is clearer to read and is self-documenting.
I always get uncomfortable if I see a {*word*192} literal value in the code. It
is never explained and is hard to change if necessary.

It also uses the VCL call, which just looks cleaner to me.

+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org)    |
| http://www.buddydog.org                           |
+===================================================+

Grossman's Law: Complex problems have answers that are
easy to discover and understand, but wrong.

Re:TEdit - Edit Box makes ding sound


You can use this procedure

void __fastcall TFrCueGastos::Ed1KeyPress(TObject *Sender, char &Key)
{
if (Key == 13)
   {
   Key = 0;
   Perform(WM_NEXTDLGCTL, 0, 0);
   }

Quote
}

perform set focus to the following control.

Regards,

Alan Jayson <al...@signalcrafters.com> wrote in article
<8079bp$4j...@forums.borland.com>...

Quote
> When pressing the Enter key in a EditBox it makes a ding sound. How do
you
> turn it off.

Other Threads