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. Miltiple CDocument & handle massage!

Miltiple CDocument & handle massage!

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

    if project had multi CDocument class which class is first handle menu massage such as Open File .... i try that my default class is CFirstDocument , other is CMyDocument , i i create menu as name "Open Image File..." & handle message in CMyDocument when program execute ,"Open Image File..." is disable !!! but when i handle it from CFirstDocument that is active ! how can i change these setting & what is order of handling messege in these case? Best Regards. MJM.

    J S PJ ArendsP 3 Replies Last reply
    0
    • M mostafa_pasha

      if project had multi CDocument class which class is first handle menu massage such as Open File .... i try that my default class is CFirstDocument , other is CMyDocument , i i create menu as name "Open Image File..." & handle message in CMyDocument when program execute ,"Open Image File..." is disable !!! but when i handle it from CFirstDocument that is active ! how can i change these setting & what is order of handling messege in these case? Best Regards. MJM.

      J Offline
      J Offline
      Jun Du
      wrote on last edited by
      #2

      I don't have a Windows platform around to verify this, but I *believe* that the first document template you add to the app in InitInstance() method will be the default document type. Change that order if it is not the document type of your choice.

      Best, Jun

      M 1 Reply Last reply
      0
      • M mostafa_pasha

        if project had multi CDocument class which class is first handle menu massage such as Open File .... i try that my default class is CFirstDocument , other is CMyDocument , i i create menu as name "Open Image File..." & handle message in CMyDocument when program execute ,"Open Image File..." is disable !!! but when i handle it from CFirstDocument that is active ! how can i change these setting & what is order of handling messege in these case? Best Regards. MJM.

        S Offline
        S Offline
        Sam Hobbs
        wrote on last edited by
        #3

        You have not specified whether the application is SDI or MDI and you have not specified what each document is for. Is this a MDI application and is each child window a separate image? If so, then perhaps an article I wrote would help. Otherwise explain a bit more what the application is doing, especially about how the document is used.

        1 Reply Last reply
        0
        • M mostafa_pasha

          if project had multi CDocument class which class is first handle menu massage such as Open File .... i try that my default class is CFirstDocument , other is CMyDocument , i i create menu as name "Open Image File..." & handle message in CMyDocument when program execute ,"Open Image File..." is disable !!! but when i handle it from CFirstDocument that is active ! how can i change these setting & what is order of handling messege in these case? Best Regards. MJM.

          PJ ArendsP Offline
          PJ ArendsP Offline
          PJ Arends
          wrote on last edited by
          #4

          File-Open is usually handled by the main frame. If you have multiple document types then the statndard behaviour is present to the user a dialog where they can choose which document type to open. The same applies for File-New.


          You may be right
          I may be crazy
          -- Billy Joel --

          Within you lies the power for good, use it!!!

          Within you lies the power for good; Use it!

          M 1 Reply Last reply
          0
          • J Jun Du

            I don't have a Windows platform around to verify this, but I *believe* that the first document template you add to the app in InitInstance() method will be the default document type. Change that order if it is not the document type of your choice.

            Best, Jun

            M Offline
            M Offline
            mostafa_pasha
            wrote on last edited by
            #5

            i change order but nothing happen! i try to search to how order for handling messages! for MDI: 1)active view object 2)the document object for the active document 3)the document template object for active document!!! 4)the frame window object of active view 5) main frame window object 6)the application object // Thanks Ivor Horton's book! for sdi because have one active frame it is obviously what order is! in my code i have Dockable window that create dynamically . in my code with CCreateContext & CFrameWnd::Create... create Frame & related view & attach them to document dynamically! it is seems that when i create new Frame can not be active frame because after i create pane i get active view for MDI code such that: CMDIFrameWnd *pFrame1 = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; // Get the active MDI child window. CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame1->GetActiveFrame(); // or CMDIChildWnd *pChild = pFrame->MDIGetActive(); // Get the active view attached to the active MDI child // window. CView * pView = pChild->GetActiveView(); after debug i see pView is kind of another view that i create for pane!!!! i try to active new frame with pFrame->GetParentFrame()->ActiveFrame(SW_RESTORE); but nothing happen. i have tree view class & two Document class & three template.

            1 Reply Last reply
            0
            • PJ ArendsP PJ Arends

              File-Open is usually handled by the main frame. If you have multiple document types then the statndard behaviour is present to the user a dialog where they can choose which document type to open. The same applies for File-New.


              You may be right
              I may be crazy
              -- Billy Joel --

              Within you lies the power for good, use it!!!

              M Offline
              M Offline
              mostafa_pasha
              wrote on last edited by
              #6

              after some try i found , error is from my view class !!! default CView class work properly !!! but own class that i derived have problem when i try to OpenDocument from another template , other CView do not work properly!

              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