CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2000
    Posts
    212

    Prevent \r\n in CEditView

    Hello

    I have a CEditView in a splitterWindow when I hit the return key the data in the windows is captured in the OnChar(...) message handler using GetWindowText(..).

    My problem is when I clear the window using SetWindowText("") it leaves a \r\n which is not what I intended. Its making my head bleed, does anyone know how to rid this \r\n.

    Thanks

    kogg
    Last edited by kogg; July 17th, 2004 at 11:48 AM.

  2. #2
    Join Date
    Sep 2002
    Posts
    924
    You trap the Enter key, copy the text, and then clear the view, but the Enter key has allready been processed and will generate a "/r/n" when the OnKeyUp event fires (after clearing the view). Trapping the key in OnChar is too late to cancel the keystroke. You should probably trap the keystroke in PreTranslateMessage rather than in OnChar, and then you should by able to cancel the keystroke so that it does not generate the unwanted "/r/n".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured