Click to See Complete Forum and Search --> : How to get Enter message in the edit control box??


April 7th, 1999, 01:47 PM
I want to change the data and display when I hit enter in the edit control box in the dialog. Is there any way I can do that??

Thanks.
Amy

ric
April 8th, 1999, 01:50 PM
You must predefine your OnOK() function first so that it won't close your dialog every time you press Enter like that CMyDialog::OnOK() {}
Just define OnClickedOK() for example. After that handle the message WM_CHAR and do you stuff in OnChar();

Oak
April 9th, 1999, 05:34 AM
Another way...
Derive new class from class CEdit

class CMyEdit : public CEdit
{
...
afx_msg void OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );

}

and overwrite there virtual function : OnChar
inside this function check if enter was pressed

But u wont be able to set this control using
Class Wizard... U ll need to set it in : OnInitDialog function or :OnInitialUpdate