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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Messages

MFC Messages

Scheduled Pinned Locked Moved C / C++ / MFC
c++debuggingquestion
3 Posts 2 Posters 1 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.
  • B Offline
    B Offline
    baerten
    wrote on last edited by
    #1

    I have a MDI Project With a MainFrm (1) There i open Child-Windows of type CMDIChildWnd (2) A View of element as type CFormView (3) And the content of the View is a Dialog (made with the Ressource Designer) (4) If i start the applic and hit a key on the ChildWindow. Which element does get the OnKeyDown Event? 2 & 3 does it not get. It's logic that the "highest" Element receive the message -> 4: The Dialog But i "linked" myself the Dialog to the CFormView ... I saw that it's possible to create directly the CFormView from out the Designer with "Add Class" Now i don't have a reaction if i hit a key on the Childform Is it absolute necessairy to create the CFormView with the Designer? In my CFormView i have afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); BEGIN_MESSAGE_MAP(TheViewClass, CFormView) . . . ON_WM_KEYDOWN() END_MESSAGE_MAP() void TheViewClass::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { CFormView::OnKeyDown(nChar, nRepCnt, nFlags); // BREAKPOINT HERE } Is it the right procedure to make ChildForms ? Big thanks

    T 1 Reply Last reply
    0
    • B baerten

      I have a MDI Project With a MainFrm (1) There i open Child-Windows of type CMDIChildWnd (2) A View of element as type CFormView (3) And the content of the View is a Dialog (made with the Ressource Designer) (4) If i start the applic and hit a key on the ChildWindow. Which element does get the OnKeyDown Event? 2 & 3 does it not get. It's logic that the "highest" Element receive the message -> 4: The Dialog But i "linked" myself the Dialog to the CFormView ... I saw that it's possible to create directly the CFormView from out the Designer with "Add Class" Now i don't have a reaction if i hit a key on the Childform Is it absolute necessairy to create the CFormView with the Designer? In my CFormView i have afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); BEGIN_MESSAGE_MAP(TheViewClass, CFormView) . . . ON_WM_KEYDOWN() END_MESSAGE_MAP() void TheViewClass::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { CFormView::OnKeyDown(nChar, nRepCnt, nFlags); // BREAKPOINT HERE } Is it the right procedure to make ChildForms ? Big thanks

      T Offline
      T Offline
      tuxyboy
      wrote on last edited by
      #2

      The event goes to the elemenet that has the focus. Check differences between onchar and onkeydown events....

      B 1 Reply Last reply
      0
      • T tuxyboy

        The event goes to the elemenet that has the focus. Check differences between onchar and onkeydown events....

        B Offline
        B Offline
        baerten
        wrote on last edited by
        #3

        Ok i see, that seems logic So i need to have in each class, that has the focus, a Message-Handler for KeyDown with the corresponding afx_msg On_KeyDown If i want catch a KeyDown on an CEdit Textbox, i need to derive a class from CEdit that has a OnKeyDown ... correct? :wtf: Can i say this->getParent()->getParent() to access the MainForm ? Many thanks ! :) All these questions aren't in MFC Books, so it's hard to find a resolution by myself:~

        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