Click here to Skip to main content
13,346,487 members (62,590 online)
Click here to Skip to main content
Add your own
alternative version

Stats

7.2K views
2 bookmarked
Posted 6 Mar 2014

CRichEditCtrl Does Not Take the Return

, 6 Mar 2014
Rate this:
Please Sign up or sign in to vote.
CRichEditCtrl does not take the return

Introduction

Using the CRichEditCtrl control in combination with the Dialog creates a small problem like Dialog eats the return key pressed message. Although I was searching for a simple and quick solution for that, I have struggled to find a definite answer.

The quickest way to get around that problem is to override PreTranslateMessage() function of a Dialog and just return FALSE when the return key pressed message is called for the Rich Edit control...

Just copy/paste:

BOOL EditDlg::PreTranslateMessage(MSG* pMsg) 
{
    if(pMsg->message == WM_KEYDOWN)
    {
        if((pMsg->lParam == IDC_RICHDIALOG_EDIT_ID/*id of a Edit Box*/) && 
            (pMsg->wParam == VK_RETURN)
        {
            return FALSE;
        }
    }
    return CDialogEx::PreTranslateMessage(pMsg);
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Arkadiusz@inquiry
United States United States
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...

Comments and Discussions

 
Question[My vote of 1] The RichEdit control has a documented interface for that Pin
.:floyd:.7-Mar-14 1:11
member.:floyd:.7-Mar-14 1:11 
AnswerRe: [My vote of 1] The RichEdit control has a documented interface for that Pin
Arkadiusz@inquiry8-Mar-14 10:14
memberArkadiusz@inquiry8-Mar-14 10:14 
QuestionQuestion Pin
Rick York6-Mar-14 13:51
memberRick York6-Mar-14 13:51 
AnswerRe: Question Pin
Arkadiusz@inquiry8-Mar-14 9:49
memberArkadiusz@inquiry8-Mar-14 9:49 
GeneralRe: Question Pin
Rick York10-Mar-14 12:16
memberRick York10-Mar-14 12:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 6 Mar 2014
Article Copyright 2014 by Arkadiusz@inquiry
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid