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. Problems with MenuEvents on Controls

Problems with MenuEvents on Controls

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

    Hi, i've made a menu with a few items. The called handlers are in "MainFrm.cpp" as On... implemented. So far so good... BUT when the focus is on an control in a sdi view of the main program i can't get the event. My Program does nothing when i click on the menuitem. How can my control get informed, when a menuitem event is fired ? Marco

    P 1 Reply Last reply
    0
    • K Koep

      Hi, i've made a menu with a few items. The called handlers are in "MainFrm.cpp" as On... implemented. So far so good... BUT when the focus is on an control in a sdi view of the main program i can't get the event. My Program does nothing when i click on the menuitem. How can my control get informed, when a menuitem event is fired ? Marco

      P Offline
      P Offline
      Pavel Klocek
      wrote on last edited by
      #2

      Are you awating the event in the CMainFrame::On... while the control has focus, or in the control itself (C?Control::On...)? Is'nt the message trapped in the CMainFrame::On..., while You are awaiting it in the control? The menu generates WM_COMMAND message which is send to the application message main message handling loop. The handler for the message is then searched in the main window, if not found in it, the handler is searched in the child window with focus and so on. Sonork 100.15206;PavelK

      K 1 Reply Last reply
      0
      • P Pavel Klocek

        Are you awating the event in the CMainFrame::On... while the control has focus, or in the control itself (C?Control::On...)? Is'nt the message trapped in the CMainFrame::On..., while You are awaiting it in the control? The menu generates WM_COMMAND message which is send to the application message main message handling loop. The handler for the message is then searched in the main window, if not found in it, the handler is searched in the child window with focus and so on. Sonork 100.15206;PavelK

        K Offline
        K Offline
        Koep
        wrote on last edited by
        #3

        Hi, the message handler code is in CMainFrame, but it is not called if the focus is at the control. The menuitem code CMainFrame::On... should work at the whole application, independently which control the focus has. Marco

        P 1 Reply Last reply
        0
        • K Koep

          Hi, the message handler code is in CMainFrame, but it is not called if the focus is at the control. The menuitem code CMainFrame::On... should work at the whole application, independently which control the focus has. Marco

          P Offline
          P Offline
          Pavel Klocek
          wrote on last edited by
          #4

          You are right. Can't figure where the problem can be :confused:. Is the control a standard one? Sonork 100.15206;PavelK

          K 1 Reply Last reply
          0
          • P Pavel Klocek

            You are right. Can't figure where the problem can be :confused:. Is the control a standard one? Sonork 100.15206;PavelK

            K Offline
            K Offline
            Koep
            wrote on last edited by
            #5

            Hmm, yes these are all standard controls. :( Marco

            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