CEdit and the return key

I have a dialog derived from cformview.

On the dialog I have a single line edit control that I treat as a command line. What I need to do is recognize when when the user finshes typing command and its arguments. What I would normally do is check is '\n' is at the end of
the CString associated with the edit box.  Problem is the '\n' gets stripped unless I use a multi-line edit box.

I really want a single line edit box.


void CView::OnUpdateEditCommandline()
{
       UpdateData(TRUE);  
      if (m_CommandLine.Right(1) =='\n')
                  {
            m_CommandLine is complete start parsing the command line
                  }
}

this only works if I resize my edit box from 1 line to 2 lines.

Any work around for this?

the styles on the Editbox are: Multiline,Auto Hscroll, Want Return
vinny5Asked:
Who is Participating?
 
rlarnerConnect With a Mentor Commented:
Try disabling BOTH Multiline and Want Return.  Then, when the user hits 'return' the default button on your dialog should be pressed.
0
 
vinny5Author Commented:
Edited text of question
0
 
vinny5Author Commented:
Edited text of question
0
 
nietodCommented:
Why not put a default button (okay) on the dialog?  When you press return, it is the same as pressing the default button.
0
 
vinny5Author Commented:
I gave it a try and it works..thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.