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. Messages Between CFormViews

Messages Between CFormViews

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++hardware
3 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.
  • J Offline
    J Offline
    John Gilbert
    wrote on last edited by
    #1

    I have multiple CFormView windows in a MFC Doc/View application that uses a Multiple View CSplitterWnd based class to switch out views in two of the panes. To control the app, I need to pass messages between views. I have a central control class embedded in the app's CDocument derived class that controls all the views (and maintains access to pointers to the CFormView window object via the Splitter based class). Anyway, to the question - Should I: 1) Pass messages to the CFormView class DIRECTLY via a "virtual int SendViewMessage(...)" method since I have direct access to the CFormView based Objects; or 2) Should I post the messages via normal Windows Message (RegisterWindowMessage) to the CFormView and let the CFormView derived classes hanlde via Message Map. I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages. Is there a rule on this somewhere ???? Or, since all Doc/View framework in the same thread, does this matter at all ???? Any info would be appreciated !!!!!! Thanks, John

    T 1 Reply Last reply
    0
    • J John Gilbert

      I have multiple CFormView windows in a MFC Doc/View application that uses a Multiple View CSplitterWnd based class to switch out views in two of the panes. To control the app, I need to pass messages between views. I have a central control class embedded in the app's CDocument derived class that controls all the views (and maintains access to pointers to the CFormView window object via the Splitter based class). Anyway, to the question - Should I: 1) Pass messages to the CFormView class DIRECTLY via a "virtual int SendViewMessage(...)" method since I have direct access to the CFormView based Objects; or 2) Should I post the messages via normal Windows Message (RegisterWindowMessage) to the CFormView and let the CFormView derived classes hanlde via Message Map. I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages. Is there a rule on this somewhere ???? Or, since all Doc/View framework in the same thread, does this matter at all ???? Any info would be appreciated !!!!!! Thanks, John

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      John Gilbert wrote: I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages There are none. You're free to invent any mechanism of data exchange between views. Or - you can use existing one - the CDocument::UpdateAllViews which gives you enough flexibility. I'd go for UpdateAllViews first, then for custom virtual function and if this doesn't fit your model, for Windows messages. Tomasz Sowinski -- http://www.shooltz.com

      "Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.

      J 1 Reply Last reply
      0
      • T Tomasz Sowinski

        John Gilbert wrote: I'm not sure of the consequences of the DIRECT approach as far as the MFC Doc/View framework is concerned. I see CDocument and CView calling methods directly in MFC rather than passing messages There are none. You're free to invent any mechanism of data exchange between views. Or - you can use existing one - the CDocument::UpdateAllViews which gives you enough flexibility. I'd go for UpdateAllViews first, then for custom virtual function and if this doesn't fit your model, for Windows messages. Tomasz Sowinski -- http://www.shooltz.com

        "Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.

        J Offline
        J Offline
        John Gilbert
        wrote on last edited by
        #3

        Thanks, UpdateAllViews() will probably do the job. I did not realize that UpdateAllViews() has two user type parameters that I can use to pass my control data. Also, someone reminded me that the CFormView Object and the actual Window are two different things. So a "Direct" call (as I was calling it) goes to the object which will eventually pass messages to the attached window anyway. I knew that :zzz:, but was getting lost in the Doc/View world :confused: . Thanks for your time to respond !!!!! :) John

        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