msmith2
asked on
disabling 'return' beeps in edit box
I am using a single-line edit box to manipulate some values. How do you disable the beep
that occurs every time a 'return' is pressed. (I have a OnKeyDown function which handles
a 'return' correctly, but I can't seem to get rid of the beep).
that occurs every time a 'return' is pressed. (I have a OnKeyDown function which handles
a 'return' correctly, but I can't seem to get rid of the beep).
It is because there is no default button in your dialog.
ASKER
How do you create a default button? It doesn't matter if it doesn't do anything as long as the beep is disabled.
ASKER
How do you create a default button? It doesn't matter if it doesn't do anything
as long as the beep is disabled.
as long as the beep is disabled.
If you have an OK button, it is usally marked as the default.
If none of your buttons have the thicker border around them to indicate that they are the default button, then edit your dialog, pick a button that you want to have respond to the enter key and sets its style to default.
Now the enter key will activate that button when you pressed.
Unless you have stuffed up the handling of it with your OnKeyDown
If none of your buttons have the thicker border around them to indicate that they are the default button, then edit your dialog, pick a button that you want to have respond to the enter key and sets its style to default.
Now the enter key will activate that button when you pressed.
Unless you have stuffed up the handling of it with your OnKeyDown
ASKER
My problem is, I don't have any buttons. The edit box is a child window. There are 32 total edit boxes. they are contained in a CWnd. The contents actually represent 32 data registers for an assember gui. I only want return to set focus back to the parent window.
I accomplished this with OnKeyDown, but it doesn't do anything with the beeps. Can I assign it a default button that doesn't actually appear on screen? How would I designate this button as default (what is the style parameter)?
I accomplished this with OnKeyDown, but it doesn't do anything with the beeps. Can I assign it a default button that doesn't actually appear on screen? How would I designate this button as default (what is the style parameter)?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! I already had my own edit class defined (CRegEdit). That solution worked great
except that I had to comment out ::TranslateMessage I think the OnChar function is also redundant to the OnKeyDown, although I will have to test this theory. Thanks a lot for making me aware of the PreTranslateMessage function. It is exactly what I needed.
except that I had to comment out ::TranslateMessage I think the OnChar function is also redundant to the OnKeyDown, although I will have to test this theory. Thanks a lot for making me aware of the PreTranslateMessage function. It is exactly what I needed.