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