Allow ENTER for next line in Multiple line EDIT BOX

1k Views Asked by At

I have multiline Edit Box (MFC). If user press Enter, the default push button have pushed and dialog ends (obviously). How to allow user to use ENTER key for the next line in edit box? I read, that I should to use ES_WANTRETURN style for this EDIT_CONTROL, but how to do it? If I have not create procedure? I have modal dialog generated from *.rc file. Thanks for helping. I need some easy way :-)

1

There are 1 best solutions below

0
Andrew Truckle On

Resource Editor

I set a few properties in the resource editor for the CEdit control:

enter image description here

  • Horizontal Scroll - I set it to false otherwise the text will not word wrap.

  • Vertical Scroll - I set it to true so that you can still view all text when it becomes too much for the control to display.

  • Multiline - Set it to true because we want multiline.

  • Want Return - Set this to true if you want the user to insert a new line when they press the Enter key (when the control has focus).


Resource File

In my RC file such a control is defined like this:

EDITTEXT        IDC_EDIT_NOTES_OPENING,15,27,200,32,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL