Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bell sounds when pressing enter key.

Status
Not open for further replies.

roadbeer69

Programmer
Mar 24, 2007
14
US
Hi All,

I have a TLabeledEdit object and an OnKeyUp event handler for it. In the event handler, I check to see if the user has pressed enter, and if they have, I enter the text in the TLabeledEdit object into a TListView. My problem is that when this happens, the machine's bell sounds. I haven't been able to find any way to stop this from happening. Below is an example of what I am doing in my OnKeyUp event handler. Can anyone please help me? Thanks in advance.

void __fastcall TMyFrame::OnKeyUpMyLabeledEdit(TObject *Sender, WORD &Key, TShiftState Shift)
{
//If there is anything in the edit box...
if (myLabeledEdit->GetTextLen() > 0)
{
if (Key == VK_RETURN)
{
//Add the contents of myLabeledEdit to a
//TListView.
//...
}
}
}

 
I don't see anything wrong with the code you've shown. Could it be either deeper in the code or Windows set up to beep on the return key?


James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thanks for the response, James.

I considered the possibility of it being deeper in the code, and tried to dumb down the OnKeyUpMyLabeledEdit method to just display a message box when it got called. The message box causes a beep, but I hear TWO beeps, meaning that the other beep is still there. You response makes me want to look into that aspect a little further. Maybe I won't even display a message box - just make the if statement a no-op.

I've no idea if Windows could be set up to beep based on a return key hit, though I do know that no other application on my machine seems to exhibit this behavior. Maybe I'll try using my app on a different machine, though, and see if it beeps there.

Thanks again,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top