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. Problem using OnKeyDown in CDialog ????

Problem using OnKeyDown in CDialog ????

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestionbusiness
6 Posts 2 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.
  • T Offline
    T Offline
    TooShy2Talk
    wrote on last edited by
    #1

    Hi, I'm using MFC Visual C++ and encountered a problem using OnKeyDown() function. The problem is that I don't get response from keyboard even if I included all the requirements. MyDlgClass.cpp ...... ...... ON_WM_KEYDOWN ...... ...... void CMyDlgClass::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { ................ CDialog::OnKeyDown(nChar, nRepCnt, nFlags); I think, the problem is that the focus wasn't on the dialog but on other objects. If I'm correct how can I possibly shift focus to the dialog or get response from the keyboard? Hope somebody can help me, thanks. }

    H 1 Reply Last reply
    0
    • T TooShy2Talk

      Hi, I'm using MFC Visual C++ and encountered a problem using OnKeyDown() function. The problem is that I don't get response from keyboard even if I included all the requirements. MyDlgClass.cpp ...... ...... ON_WM_KEYDOWN ...... ...... void CMyDlgClass::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { ................ CDialog::OnKeyDown(nChar, nRepCnt, nFlags); I think, the problem is that the focus wasn't on the dialog but on other objects. If I'm correct how can I possibly shift focus to the dialog or get response from the keyboard? Hope somebody can help me, thanks. }

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Do you have any controls on the dialog?

      T 1 Reply Last reply
      0
      • H Hamid Taebi

        Do you have any controls on the dialog?

        T Offline
        T Offline
        TooShy2Talk
        wrote on last edited by
        #3

        Hamid. wrote:

        Do you have any controls on the dialog?

        Yes, CButtons and CEdit controls.

        H 1 Reply Last reply
        0
        • T TooShy2Talk

          Hamid. wrote:

          Do you have any controls on the dialog?

          Yes, CButtons and CEdit controls.

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          So you can use of PreTranslateMessage.

          T 1 Reply Last reply
          0
          • H Hamid Taebi

            So you can use of PreTranslateMessage.

            T Offline
            T Offline
            TooShy2Talk
            wrote on last edited by
            #5

            Ok, Thanks a lot. I'll try this.

            H 1 Reply Last reply
            0
            • T TooShy2Talk

              Ok, Thanks a lot. I'll try this.

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              You can use of those events,but you dont have any control on the dialog. ;)

              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