Solved

CComboEditBox - update on enter key

Posted on 2004-04-06
5
203 Views
Last Modified: 2013-11-20
How can I capture the user hitting the enter key while on a comboEditBox in MFC? (im using MFC in the .NET environment, but its still MFC).
0
Comment
Question by:CairoBoyce1024
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
lakshman_ce earned 150 total points
ID: 10770607
Override the PreTranslateMessage method in your combo box

BOOL CMyComboBox::PreTranslateMessage(MSG* pMsg)
{
      if (pMsg->message == WM_KEYDOWN)
      {
            
                   int nVirtKey = (int) pMsg->wParam;
            
                              if (nVirtKey==13)//VK_ENTER
            {
                  CString text;
                  GetWindowText(text);
                  return TRUE;
            }      
      
      }

      return CComboBox::PreTranslateMessage(pMsg);
}

-Lakshman
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 100 total points
ID: 10771884
0
 

Author Comment

by:CairoBoyce1024
ID: 11865585
Tried it at the time and it didnt work - will look again tomorrow (22nd).  I have more idea what I am doing now...
0
 

Author Comment

by:CairoBoyce1024
ID: 11886995
couldnt have done it without AlexFM's comment - thought it would be simpler but thanks dudes
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 55
Process filename extension 3 209
viewing source code from eclipse 13 110
bigDiff challenge 17 135
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question