Archived

This topic is now archived and is closed to further replies.

Xtremehobo

Edit Box detecting input

Recommended Posts

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 :\

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites