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. UpdateAllViews (...) - a trivial question

UpdateAllViews (...) - a trivial question

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++announcement
5 Posts 4 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    Hello, MSDN says void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL ); Now this call is in my menuclick event in the doc cpp. Lets say a view class called CViewTwo generated the click. I want view1 to reflect the changes, but not sending class (the CViewTwo class). I think if I dont have a NULL argument, it excludes the update of pSender. I am not sure exactly what will go into CView* pSender. How do I get the pointer to my sending viewclass from the doc click event? Thanks so much!

    J J S 3 Replies Last reply
    0
    • N ns

      Hello, MSDN says void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL ); Now this call is in my menuclick event in the doc cpp. Lets say a view class called CViewTwo generated the click. I want view1 to reflect the changes, but not sending class (the CViewTwo class). I think if I dont have a NULL argument, it excludes the update of pSender. I am not sure exactly what will go into CView* pSender. How do I get the pointer to my sending viewclass from the doc click event? Thanks so much!

      J Offline
      J Offline
      Jim A Johnson
      wrote on last edited by
      #2

      If your doc handles the click, there is no sending view. You need to handle the click in the view, not the doc, to do what you're asking.

      1 Reply Last reply
      0
      • N ns

        Hello, MSDN says void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL ); Now this call is in my menuclick event in the doc cpp. Lets say a view class called CViewTwo generated the click. I want view1 to reflect the changes, but not sending class (the CViewTwo class). I think if I dont have a NULL argument, it excludes the update of pSender. I am not sure exactly what will go into CView* pSender. How do I get the pointer to my sending viewclass from the doc click event? Thanks so much!

        J Offline
        J Offline
        jmkhael
        wrote on last edited by
        #3

        CDocument::GetFirstViewPosition MSDN Says it better Papa Murex Co. Papa Charchabil

        1 Reply Last reply
        0
        • N ns

          Hello, MSDN says void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL ); Now this call is in my menuclick event in the doc cpp. Lets say a view class called CViewTwo generated the click. I want view1 to reflect the changes, but not sending class (the CViewTwo class). I think if I dont have a NULL argument, it excludes the update of pSender. I am not sure exactly what will go into CView* pSender. How do I get the pointer to my sending viewclass from the doc click event? Thanks so much!

          S Offline
          S Offline
          surbinsho
          wrote on last edited by
          #4

          jim is right to do your task the calling should be in view it can be done in following way suppose your classes are CMyDoc CView1 CView2 now in CView2 class on handler of the click event u can do this CMyDoc *pDoc=this->GetDocument(); pDoc->UpdateAllViews(this);//passing this as argument excludes the view from which the function is called pDoc->UpdateAllViews(NULL);//updates all views attached to document including the view from which the function is called(in this case view2) surbinsho

          N 1 Reply Last reply
          0
          • S surbinsho

            jim is right to do your task the calling should be in view it can be done in following way suppose your classes are CMyDoc CView1 CView2 now in CView2 class on handler of the click event u can do this CMyDoc *pDoc=this->GetDocument(); pDoc->UpdateAllViews(this);//passing this as argument excludes the view from which the function is called pDoc->UpdateAllViews(NULL);//updates all views attached to document including the view from which the function is called(in this case view2) surbinsho

            N Offline
            N Offline
            ns
            wrote on last edited by
            #5

            Thank you so much for the responses. It works well, but I do have to set the controls newvalues by coding the OnUpdate event of the view thats supposed to reflect the changes. I get the doc pointer both in the sending view (to set the new value for the doc variable , as well as in the receiving view where I get the doc pointer in order to access the newly changed value. Thanks, ns

            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