Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. keyboard key event

keyboard key event

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesign
28 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Ram Murali

    BOOL CTest::PreTranslateMessage(MSG* pMsg) { if( WM_KEYDOWN == pMsg->message ) { if( ::GetParent( pMsg->hwnd ) == m_combo.m_hWnd ) { TCHAR tcChar[2] = {0}; tcChar[0] = pMsg->wParam; AfxMessageBox( tcChar ); } } return CTest::PreTranslateMessage(pMsg); } Regards, Ram

    N Offline
    N Offline
    Naveen
    wrote on last edited by
    #17

    Ram Murali wrote:

    return CTest::PreTranslateMessage(pMsg);

    here lies the problem it should be like this CDialog::PreTranslateMessage(pMsg); nave

    R 1 Reply Last reply
    0
    • N Naveen

      Ram Murali wrote:

      return CTest::PreTranslateMessage(pMsg);

      here lies the problem it should be like this CDialog::PreTranslateMessage(pMsg); nave

      R Offline
      R Offline
      Ram Murali
      wrote on last edited by
      #18

      wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram

      N T 2 Replies Last reply
      0
      • R Ram Murali

        wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #19

        Ram Murali wrote:

        now i can able to key-in only one character.

        what do u mean? nave

        R 1 Reply Last reply
        0
        • N Naveen

          ThatsAlok wrote:

          OnKeyDown

          r u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox. It cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox nave

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #20

          Naveen R wrote:

          u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox.

          I believe you havn't read my question carefully!, after reading your discussion with the PP(Problem Poster), i come to know he need to implement that for Combo Box!

          Naveen R wrote:

          t cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox

          Really do you need my comment on this?

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

          N 1 Reply Last reply
          0
          • N Naveen

            Ram Murali wrote:

            now i can able to key-in only one character.

            what do u mean? nave

            R Offline
            R Offline
            Ram Murali
            wrote on last edited by
            #21

            Let me explain my objective briefly. I need to desing combobox in such a way tat user can only enter the character "D", "I" and "0-9", in the combobox. If a user enters other character than the above specified, it should not be displayed in the Combobox. and the maximum no of character user can enter is only 5. this is my objective. with the current code, i can only enter one character. if i press the other character, the new one replaces the old character in the combobox. lets say i wannu enter "HELLO" if i press "H" message box shows H. then if i enter I, this I replace the H in the combobox. :(:^) again thanx a lot for ur spending ur valuable time for me. Regards, Ram

            N 1 Reply Last reply
            0
            • R Ram Murali

              wow. thats gr8. But now i can able to key-in only one character. cannot key-in more than one char.:( Thanx for spending ur time for me. Thanx a lot. Regards, Ram

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #22

              Ram Murali wrote:

              ut now i can able to key-in only one character. cannot key-in more than one char.:(

              create a string there only!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              1 Reply Last reply
              0
              • T ThatsAlok

                Naveen R wrote:

                u saying that u can get the key down event in the combobox just by doing like this. the WM_KEYDOWN message goes to the edit control inside the combobox.

                I believe you havn't read my question carefully!, after reading your discussion with the PP(Problem Poster), i come to know he need to implement that for Combo Box!

                Naveen R wrote:

                t cannot be mapped like this from the dialog class, nor from a class drived from CCcomboBox

                Really do you need my comment on this?

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                N Offline
                N Offline
                Naveen
                wrote on last edited by
                #23

                ThatsAlok wrote:

                i come to know he need to implement that for Combo Box!

                its in the first question it self.:cool: nave

                T 1 Reply Last reply
                0
                • R Ram Murali

                  Let me explain my objective briefly. I need to desing combobox in such a way tat user can only enter the character "D", "I" and "0-9", in the combobox. If a user enters other character than the above specified, it should not be displayed in the Combobox. and the maximum no of character user can enter is only 5. this is my objective. with the current code, i can only enter one character. if i press the other character, the new one replaces the old character in the combobox. lets say i wannu enter "HELLO" if i press "H" message box shows H. then if i enter I, this I replace the H in the combobox. :(:^) again thanx a lot for ur spending ur valuable time for me. Regards, Ram

                  N Offline
                  N Offline
                  Naveen
                  wrote on last edited by
                  #24

                  Ram Murali wrote:

                  the new one replaces the old character in the combobox

                  this is happening only because ur showing a messagebox in that code. Try removing the AfxMessageBox in that code. nave

                  R 1 Reply Last reply
                  0
                  • N Naveen

                    Ram Murali wrote:

                    the new one replaces the old character in the combobox

                    this is happening only because ur showing a messagebox in that code. Try removing the AfxMessageBox in that code. nave

                    R Offline
                    R Offline
                    Ram Murali
                    wrote on last edited by
                    #25

                    Ya.its working now. thanx for ur help.:-D Regards, Ram

                    1 Reply Last reply
                    0
                    • N Naveen

                      ThatsAlok wrote:

                      i come to know he need to implement that for Combo Box!

                      its in the first question it self.:cool: nave

                      T Offline
                      T Offline
                      ThatsAlok
                      wrote on last edited by
                      #26

                      Naveen R wrote:

                      its in the first question it self.:cool:

                      then thats my mistake :).... Sorry:)

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                      N 1 Reply Last reply
                      0
                      • T ThatsAlok

                        Naveen R wrote:

                        its in the first question it self.:cool:

                        then thats my mistake :).... Sorry:)

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                        cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                        N Offline
                        N Offline
                        Naveen
                        wrote on last edited by
                        #27

                        hei, I found u too fro India. ur from which part of India? I am from kerala... nave

                        T 1 Reply Last reply
                        0
                        • N Naveen

                          hei, I found u too fro India. ur from which part of India? I am from kerala... nave

                          T Offline
                          T Offline
                          ThatsAlok
                          wrote on last edited by
                          #28

                          Naveen R wrote:

                          I found u too fro India. ur from which part of India?

                          Haridwar

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups