Reputation: 703
I have a Edit Controll (where u can write stuff) in my code, and I want that when the user will type enter (like in forms of - username / pass), it'll do something..
for example, When you logg into a site and you put ur username and pass, if you click enter, it loggs in automaticly for you, instead of clicking the "connect" button...
I have the following code :
ChatHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", NULL, WS_CHILD | WS_VSCROLL | WS_HSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_WANTRETURN , 15, 15, 550, 300, hwnd, NULL,
(HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); // Creat chat log
It's written in Win API...
Thanks!
Upvotes: 0
Views: 288
Reputation: 15365
If you have a Dialog the Enter key is automatically handeled in a seperate way.
If you have your own Frame Control and want in Detail a seperate Handling of the Input you have two choices:
Upvotes: 0
Reputation: 10415
Remove the ES_WANTRETURN style from the control so the return key will go to the parent dialog. In the parent dialog handle the EN_KILLFOCUS notification (in WM_COMMAND). The wParam that comes with the notification will tell you if if was the edit control you are interested in.
Upvotes: 2