Hi, How do I determine when the user has finished entering text in an edit box. In other words, how do I know he has pressed the enter key and has completed typing in the text.
Printable View
Hi, How do I determine when the user has finished entering text in an edit box. In other words, how do I know he has pressed the enter key and has completed typing in the text.
Hi,
You cannot trap enter from an edit box in the parent, you need to
derive a new class from CEdit and process the WM_CHAR mesgs
You can also handle the WM_KILLFOCUS message.
If the edit control is in a dialog you can use classwizard to process the EN_CHANGE or the EN_UPDATE message of the edit control.
Then you can access the data of the Edit control and check if the last character is '\n'
If this is a single line edit box, it cannot have a '\n' at the end.
Thank you, but i cannot access the onKillFoucs event just by pressing the Enter key, i tryed the onKeyDown for the dialog but i had no result.
What do you think might be the solution?
thank you for your time
When you press ENTER in a dialog, it activates the default button, so if you have an OK button the dialog will be closed. KillFocus is sent when the user deactivates the control (by pressing TAB or clicking somewhere in the dialog) - this way the window is not closed.
Thanks but i still wonder how to work with the onKeyDown event!