Главная страница | назад





Article #16773: Stopping a TEdit from beeping when hitting 'Enter'

 Question and Answer Database
FAQ1773C.txt Stopping a TEdit from beeping when hitting 'Enter'
Category :VCL
Platform :All
Product :C++Builder 1.x
Question:
If I key a carriage return when editing a Tedit component,
a beep is automatically issued.
How do I disable this?
Answer:
Windows Edit controls do not accept VK_RETURN messages.
You may intercept this in the KeyPress event so that it does not
get to the control. ie:
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
if (Key == VK_RETURN) {
// handle the 'Enter' key press event as you please
Key = NULL;
}
}
//---------------------------------------------------------------------------
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99