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. catching return key (VK_RETURN) with OnKeyDown

catching return key (VK_RETURN) with OnKeyDown

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • V Offline
    V Offline
    V 0
    wrote on last edited by
    #1

    Hello, It seems that in the app. where I'm working on, the default behaviour of OnKeyDown doesn't seem to catch the return key. Can you modify this? Can you modify this for 1 class and not for the entire app.? tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

    S L 2 Replies Last reply
    0
    • V V 0

      Hello, It seems that in the app. where I'm working on, the default behaviour of OnKeyDown doesn't seem to catch the return key. Can you modify this? Can you modify this for 1 class and not for the entire app.? tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

      S Offline
      S Offline
      svincent
      wrote on last edited by
      #2

      Hi , you need to overide the virtualfunction OnGetDlgCode, and then write the following line of code . Your Class must be derived from CWnd. return CYourClass::OnGetDlgCode() | DLGC_WANTALLKEYS; Djizzio

      V 1 Reply Last reply
      0
      • S svincent

        Hi , you need to overide the virtualfunction OnGetDlgCode, and then write the following line of code . Your Class must be derived from CWnd. return CYourClass::OnGetDlgCode() | DLGC_WANTALLKEYS; Djizzio

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        Hey, tnx for your reply. I did this: UINT CtrlFlexArray::OnGetDlgCode(){ return CWnd::OnGetDlgCode() | DLGC_WANTALLKEYS; } //end function OnGetDlgCode but the OnKeyDown still doesn't catch the return key. Did I forgot something or did I do something wrong? (NOTE: CtrlFlexArray is derived from CvsFlexArray and CvsFlexArray from CWnd, but I don't think this is the problem) tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

        U 1 Reply Last reply
        0
        • V V 0

          Hello, It seems that in the app. where I'm working on, the default behaviour of OnKeyDown doesn't seem to catch the return key. Can you modify this? Can you modify this for 1 class and not for the entire app.? tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Is it a dialog based application ? If so there is information in the FAQ forum[^]. Elaine :rose: The tigress is here :-D

          V 1 Reply Last reply
          0
          • L Lost User

            Is it a dialog based application ? If so there is information in the FAQ forum[^]. Elaine :rose: The tigress is here :-D

            V Offline
            V Offline
            V 0
            wrote on last edited by
            #5

            I found my error; Forgot to add a WM message;:doh: but hey, now it works :-D "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

            1 Reply Last reply
            0
            • V V 0

              Hey, tnx for your reply. I did this: UINT CtrlFlexArray::OnGetDlgCode(){ return CWnd::OnGetDlgCode() | DLGC_WANTALLKEYS; } //end function OnGetDlgCode but the OnKeyDown still doesn't catch the return key. Did I forgot something or did I do something wrong? (NOTE: CtrlFlexArray is derived from CvsFlexArray and CvsFlexArray from CWnd, but I don't think this is the problem) tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

              U Offline
              U Offline
              User 5680157
              wrote on last edited by
              #6

              Don't forget to add ON_WM_GETDLGCODE() to the message map of your class.

              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