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. From A FrameWindow

From A FrameWindow

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • G Offline
    G Offline
    grassrootkit
    wrote on last edited by
    #1

    How do you route message to a view? I have a CFormView. I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level. For example, I want to handle Window-maximize event from my CFormView. Or if there's a way I can route the message from CFrameWnd to CFormView, it'll be great. Any idea?

    S 1 Reply Last reply
    0
    • G grassrootkit

      How do you route message to a view? I have a CFormView. I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level. For example, I want to handle Window-maximize event from my CFormView. Or if there's a way I can route the message from CFrameWnd to CFormView, it'll be great. Any idea?

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      grassrootkit wrote:

      I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level

      Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.

      void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
      {
      GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);

      CFrameWndEx::OnSysCommand(nID, lParam);
      }

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      G 2 Replies Last reply
      0
      • S Stuart Dootson

        grassrootkit wrote:

        I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level

        Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.

        void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
        {
        GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);

        CFrameWndEx::OnSysCommand(nID, lParam);
        }

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        G Offline
        G Offline
        grassrootkit
        wrote on last edited by
        #3

        charm!

        1 Reply Last reply
        0
        • S Stuart Dootson

          grassrootkit wrote:

          I want to handle menu events in my View. But my CFrameWnd is actually capturing the events of the Frame level

          Only if you have relevant handlers in your frame? I have a vanilla SDI app. I've just added a handler for ID_FILE_OPEN to the view class. It caught the relevant message. For the maximize event, you will have to explicitly route the message. Add the following handler to your frame class and your view should get visibility of maximize events.

          void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
          {
          GetActiveView()->SendMessage(WM_SYSCOMMAND, nID, lParam);

          CFrameWndEx::OnSysCommand(nID, lParam);
          }

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          G Offline
          G Offline
          grassrootkit
          wrote on last edited by
          #4

          Also Stuart, how do we access the Document from a Dialog that I added through "insert new dialog" in resource option?

          S 1 Reply Last reply
          0
          • G grassrootkit

            Also Stuart, how do we access the Document from a Dialog that I added through "insert new dialog" in resource option?

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            Well, you would need to tell the dialog about the document. You could add a CDocument* member variable to the dialog and set it before you call DoModal. Alternatively (and I prefer this one), just pass the relevant attributes of the document to the dialog, so the dialog doesn't need to know about the document - letting the dialog have visibility of the document class upsets my aesthetic sense.

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            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