[win32 GDI]Remind me... Looking for ENTER

Started by
2 comments, last by Skizz 17 years, 2 months ago
I have gone brain dead or something. I need help! I need to know when someone has entered a new value in an Edit Box and hit return. I'm doing this in my message loop, but its wrong! I used to know this... once!
		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
			case IDC_EB_numVerts: // EidtBox ID 
				if (HIWORD(wParam) == VK_RETURN )
					g_log->Log("numVerts\n");
				break;
....

Any help appreciated :)
Advertisement
I cannot remember if edit controls support the NM_RETURN notification but if they dont then you will need to subclass the edit control.
If I recall correctly when you press enter the default behavior is for the edit control to look for a button with the BS_DEFPUSHBUTTON style and simulate a click of that. You can override this by specifying ES_WANTRETURN. So, assuming your UI is simple enough you can just put the edit handler code in the button handler and skip all the complicated stuff like subclassing. I could be misrembering, it's been a long time.

And to nitpick, this topic has 100% completely nothing to do with GDI...
-Mike
How about the EN_CHANGE message, sent using the WM_COMMAND message. OK, it doesn't respond to a return but will be sent whenever the text changes.

Skizz

This topic is closed to new replies.

Advertisement