Link to home
Start Free TrialLog in
Avatar of msmith2
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).
Avatar of RONSLOW
RONSLOW

It is because there is no default button in your dialog.

Avatar of msmith2

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.
Avatar of msmith2

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.
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

Avatar of msmith2

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)?
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of msmith2

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.