locked
Edit Control Customization RRS feed

  • Question

  • I'm trying to change the behaviour of EditControl to work like notepad in my dialog based application. To get a new line we normally have to do Ctrl+Enter in multiline edit control. I want to do the same when only Enter key is pressed. To do this i have subclassed CEdit class and in OnChar() i can get control when Enter key is pressed. I don't know what to do inside the handler to simulate the Ctrl+Enter. I tried using keybd_event() but didn't work, can someone point me how to proceed furthur please?

     

     

    void MyApp::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
    {
     

     if (nChar == VK_RETURN)
      {
      //I Don't know what to do here
      return;

        }


     CEdit::OnChar(nChar, nRepCnt, nFlags);
    }

    Saturday, January 15, 2011 6:23 PM

All replies

  • prashant20010 wrote:

    I'm trying to change the behaviour of EditControl to work like notepad  in my dialog based application. To get a new line we
    normally have to do Ctrl+Enter in multiline edit control.

    Not at all. Simple Enter should work. If your control is on a dialog,  make sure to give it ES_WANTRETURN style.


    Igor Tandetnik

    Saturday, January 15, 2011 6:26 PM
  • ohh didn't know that was that easy :) Thanks very much.
    Saturday, January 15, 2011 6:37 PM
  • Resource view, dialog template editor, make sure choosed "Want return" property.


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE platform embedded development.
    Sunday, January 16, 2011 4:14 AM
  • Resource view, dialog editor, make sure choosed "Want return" property in edit properties.
    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE platform embedded development.
    Sunday, January 16, 2011 4:16 AM