Edit Box detecting input

Started by
3 comments, last by Xtremehobo 20 years, 8 months ago
How would I go about detecting when someone presses the enter key in an edit box on my win32 dialog? I''ve tried hooking the EN_CHANGE notification in the parent window''s WM_COMMAND message bt it still won''t work :\
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
Advertisement
If you are using a multiline edit make sure you specify the ES_WANTRETURN style. If that doesn''t work, or if you are not using a multiline edit I suggest subclassing the edit and handling the WM_KEYDOWN message.


Qui fut tout, et qui ne fut rien
Invader''s Realm
If I subclass it though, won''t I have to do my own custom drawing or does the win32 api provide a function for doing that?
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
*sigh*
I created an "invisible default button" and it works now
pixelwrench.com | [email="matt[nospam]@pixelwrench[nospam]com"]email[/email] lethalhamster: gamedev keeps taking my money, but im too lazy to not let them
quote:Original post by Xtremehobo
If I subclass it though, won''t I have to do my own custom drawing or does the win32 api provide a function for doing that?


Nope. You can just handle the WM_KEYDOWN message. Instead of calling DefWindowProc() you can call CallWindowProc() and let the default window proc for the edit handle the drawing. See the example here


Qui fut tout, et qui ne fut rien
Invader''s Realm

This topic is closed to new replies.

Advertisement