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. what is correct way to update custom dialogbars in document/view?

what is correct way to update custom dialogbars in document/view?

Scheduled Pinned Locked Moved C / C++ / MFC
questionarchitectureannouncement
3 Posts 3 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
    gor
    wrote on last edited by
    #1

    What is correct way to update custom dialogbars in document/view MDI architecture when the current document is deactivated or a new document is activated. I am currently trying to send messages to the CMainFrame:public CMDIFrameWnd when a CView is selected and sets a different active document. This does not take into account other ways in which the Active document might be set (I don't know hat these might be). CMainFrame can see all the dialog bars and should be the one to update them based on the active document when the active document is changed. I was looking for a simple OnActivateDocument() event, or something like it, in CMainFrame couldn't seem to find it. There has to be a simple way and I am just missing it.

    M C 2 Replies Last reply
    0
    • G gor

      What is correct way to update custom dialogbars in document/view MDI architecture when the current document is deactivated or a new document is activated. I am currently trying to send messages to the CMainFrame:public CMDIFrameWnd when a CView is selected and sets a different active document. This does not take into account other ways in which the Active document might be set (I don't know hat these might be). CMainFrame can see all the dialog bars and should be the one to update them based on the active document when the active document is changed. I was looking for a simple OnActivateDocument() event, or something like it, in CMainFrame couldn't seem to find it. There has to be a simple way and I am just missing it.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      By design, this is usually done in a CView::OnInitialUpdate() override. If you really must handle window initialization from another window class then you can define your own WM_ messages or add methods to your window classes. At that point you're really not tied to the Doc/View architecture so you may find yourself fighting it. If you handle scrollbar initialization in a CView::OnInitialUpdate() override then your view classes will stay within the doc/view framework. Just call it when you change the view's associated document.

      1 Reply Last reply
      0
      • G gor

        What is correct way to update custom dialogbars in document/view MDI architecture when the current document is deactivated or a new document is activated. I am currently trying to send messages to the CMainFrame:public CMDIFrameWnd when a CView is selected and sets a different active document. This does not take into account other ways in which the Active document might be set (I don't know hat these might be). CMainFrame can see all the dialog bars and should be the one to update them based on the active document when the active document is changed. I was looking for a simple OnActivateDocument() event, or something like it, in CMainFrame couldn't seem to find it. There has to be a simple way and I am just missing it.

        C Offline
        C Offline
        Cliff Hatch
        wrote on last edited by
        #3

        gor wrote:

        CMainFrame can see all the dialog bars and should be the one to update them based on the active document when the active document is changed.

        I agree. I update dialog bars from CMainFrame in much the same way as you descibe, except that I make the functions public and call them directly from my view/doc classes instead of sending messages. I override CView::OnActivateView() to get the correct action when the current view is deactivated or a new view is activated. The only problem I had with this was coping with the counter-intuitive way the system sets the pActiveView and pDeactiveView parameters (I'm not sure if this is relevant to your enquiry, but I can provide a code sample if you are interested). I don't know if this is the best approach, but I can vouch for the fact that it works, and that it deals with activation of views by conventional mouse clicks and custom code. It seems strange to me too that there is no function in the CMDIFrameWnd class that can be overridden to achieve this - if you ever discover a better way I would be very interested to hear. Best Regards Cliff

        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