Solved

Doesn't work for ComboBox with KEYDOWN

Posted on 2000-03-08
6
614 Views
Last Modified: 2013-11-20
Hi pagladasu,

   I tried to trapping on ListBox that it worked but on ComboBox no worked,please tell me too.

   Regards,
   Aroon
0
Comment
Question by:Berm
[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
  • 4
  • 2
6 Comments
 

Author Comment

by:Berm
ID: 2603196
Adjusted points to 10
0
 

Author Comment

by:Berm
ID: 2603197
Hi everyone,

    Would you help me too.
    From pagladasu's information that cann't trap with keydown on combobox,as when press enter key on it no reaction but listbox it's OK.

    Who can help me ?

    Please !!!

    Regards,
    Berm
0
 

Accepted Solution

by:
namrata earned 10 total points
ID: 2611859
I hope you are writing your code in WM_KEYDOWN event. is it true? Instead, you need to write code in PretranslateMessage event.  Catch WM_KEDOWN in pretranslatemessage. it should work. Here is the code :

BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
CWnd* pWnd = GetFocus();
if(pWnd->GetDlgCtrlID() == IDC_COMBOBOX) {
    switch (pMsg->message)
     {
      case WM_KEYDOWN :
        switch(pMsg->wParam) {
                   case VK_RETURN :
              // write your code
                    break;
                }
               break;
     }
}
}

Hope this helps,
Namrata                         
0
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!

 

Author Comment

by:Berm
ID: 2648414
Hi Namrata or Anyone,

    Thanks!
     OK,it worked but VK_RETURN id program was unknown when i changed with "13",so it worked

   Why did it no work with VK_RETURN id ?

   Would you tell me please?

   Regards,
   Berm

NOTE : I accepted your answer and  selected an appropriate grade for you is "A"
0
 

Expert Comment

by:namrata
ID: 2648683
Hi Berm,

Thanks for the points and grade.

I am also surprised why VK_RETURN is not working. In your winuser.h file, there should be following line :
#define VK_RETURN         0x0D
is it there? I am novice in MFC programming. so i will try to find out an answer.

Thanks again,
Namrata
0
 

Author Comment

by:Berm
ID: 2651872
Hi Namrata,
 
     Yes,it is.
     Never mind !
    You will be The Novice or The Expert;i don't care.

    Because your answer post me that it's a Great help from you to me,so i think you're THE HELPER for me.

    Also thanks again if you will try to find out an answer for me.

      Sincerely,
      Berm


0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

689 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