Click here to Skip to main content
15,914,820 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString or LPCTSTR...which one's better? Pin
TeeBee30313-Jun-03 2:10
TeeBee30313-Jun-03 2:10 
GeneralCEdit and the Return key Pin
CodeBrain13-Jun-03 1:42
CodeBrain13-Jun-03 1:42 
GeneralRe: CEdit and the Return key Pin
rrrado13-Jun-03 1:58
rrrado13-Jun-03 1:58 
GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 2:23
CodeBrain13-Jun-03 2:23 
GeneralRe: CEdit and the Return key Pin
Johann Gerell13-Jun-03 2:17
Johann Gerell13-Jun-03 2:17 
GeneralRe: CEdit and the Return key Pin
Roger Allen13-Jun-03 2:17
Roger Allen13-Jun-03 2:17 
GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 3:47
CodeBrain13-Jun-03 3:47 
GeneralRe: CEdit and the Return key Pin
Ryan Binns13-Jun-03 4:05
Ryan Binns13-Jun-03 4:05 
I would have overridden PreTranslateMessage() in your edit control, and just sent a message to the parent:
BOOL CMyEdit::PreTranslateMessage(MSG *pMsg)
{
    if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
    {
        CWnd *pParent = GetParent();
        if(pParent != NULL)
            pParent->SendMessage(WM_KEYDOWN, VK_RETURN, pMsg->lParam);
    }
    else
        return CEdit::PreTranslateMessage(pMsg);
}

And then just handle WM_KEYDOWN like normal in the parent and check for Enter being pressed. If you need to handle it in your main frame window, then use AfxGetMainWnd() instead of GetParent().

Ryan

Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)

Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

GeneralRe: CEdit and the Return key Pin
CodeBrain13-Jun-03 4:44
CodeBrain13-Jun-03 4:44 
QuestionHow do you prevent a window from being minimized? Pin
Abin13-Jun-03 1:21
Abin13-Jun-03 1:21 
AnswerRe: How do you prevent a window from being minimized? Pin
rrrado13-Jun-03 1:41
rrrado13-Jun-03 1:41 
GeneralRe: How do you prevent a window from being minimized? Pin
Abin13-Jun-03 1:44
Abin13-Jun-03 1:44 
QuestionHow to find active control ? Pin
rrrado13-Jun-03 0:31
rrrado13-Jun-03 0:31 
AnswerRe: How to find active control ? Pin
User 665813-Jun-03 1:20
User 665813-Jun-03 1:20 
GeneralRe: How to find active control ? Pin
rrrado13-Jun-03 1:39
rrrado13-Jun-03 1:39 
GeneralGetting Call Stack info Pin
Ceri13-Jun-03 0:09
Ceri13-Jun-03 0:09 
GeneralRe: Getting Call Stack info Pin
Neville Franks13-Jun-03 0:20
Neville Franks13-Jun-03 0:20 
GeneralRe: Getting Call Stack info Pin
Ceri13-Jun-03 0:53
Ceri13-Jun-03 0:53 
GeneralRe: Getting Call Stack info Pin
Neville Franks13-Jun-03 1:26
Neville Franks13-Jun-03 1:26 
GeneralRe: Getting Call Stack info Pin
Franz Klein13-Jun-03 2:28
Franz Klein13-Jun-03 2:28 
Generalblue screen Pin
fabio9712-Jun-03 23:56
fabio9712-Jun-03 23:56 
GeneralRe: blue screen Pin
Brian van der Beek13-Jun-03 0:19
Brian van der Beek13-Jun-03 0:19 
GeneralRe: blue screen Pin
fabio9713-Jun-03 0:35
fabio9713-Jun-03 0:35 
GeneralRe: blue screen Pin
Brian van der Beek13-Jun-03 0:42
Brian van der Beek13-Jun-03 0:42 
GeneralRe: blue screen Pin
David Crow13-Jun-03 3:08
David Crow13-Jun-03 3:08 

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.