how can I respond Enter Event in a editbox?
-
a:((how can I respond Enter Event in a editbox? I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input. how can I make this ? Anyone can give me a clear answer?Thanks. YES, I am here.
-
a:((how can I respond Enter Event in a editbox? I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input. how can I make this ? Anyone can give me a clear answer?Thanks. YES, I am here.
-
Here is one solution. -create editbox -add a button -set button as default button -when the user presses Enter, the button is press -now you can do whatever you want including clear editbox Kuphryn
-
a:((how can I respond Enter Event in a editbox? I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input. how can I make this ? Anyone can give me a clear answer?Thanks. YES, I am here.
Hello, the codegurus around the world.;) This is one of the famous questions in MFC. If you push Enter key, the dialog will be closed. One solution is that you can trap Enter key message by PreTranslateMessage before Enter Key message sends to the dialog. And you can check if EditBox actually get the input focus in PreTranslateMessage. Also, Paul Deliacia(?) posts his article in this question in MSDN magazine. Please, don't send me your email about your questions directly. Have a nice day! Sonork - 100.10571:vcdeveloper ;)
-Masaaki Onishi-
-
I know this solution,but that's it,I don't want to add a button.I just want to respond the Enter Key.so... YES, I am here.
You can derive your own edit control from CEdit and overide handling of keyboard messages. Then You can send a custom notification message to the parent window (dialog, form). See the edit control section here at CP for inspiration. Sonork 100.15206;PavelK
-
a:((how can I respond Enter Event in a editbox? I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input. how can I make this ? Anyone can give me a clear answer?Thanks. YES, I am here.
I always do stuff like that in my OnOK() function.
void CMyDialog::OnOK
{
if (GetFocus() == c_MyEditControl)
{
// do the stuff needed when the enter key is pressed
// when my edit control has the focus
}
else
// call base class for default handling
CDialog::OnOK();
}
CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!
-
I always do stuff like that in my OnOK() function.
void CMyDialog::OnOK
{
if (GetFocus() == c_MyEditControl)
{
// do the stuff needed when the enter key is pressed
// when my edit control has the focus
}
else
// call base class for default handling
CDialog::OnOK();
}
CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!