Solved

Doesn't work for ComboBox with KEYDOWN

Posted on 2000-03-08
6
609 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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