Seprating client area in MDI application.
-
how seprate client area of application from frame window in MDI? is way is correct sepreate CChildFrame ??? alternative way i hear is : create window with WS_OVERLAPPED! but when i try this:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.style |= WS_OVERLAPPED; if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return TRUE; }
there is nothing happen. Best Regards. MJM -
how seprate client area of application from frame window in MDI? is way is correct sepreate CChildFrame ??? alternative way i hear is : create window with WS_OVERLAPPED! but when i try this:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.style |= WS_OVERLAPPED; if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return TRUE; }
there is nothing happen. Best Regards. MJM -
mostafa_pasha wrote:
seprate client area of application from frame window in MDI?
Please be more specific on what you want to do.
Best, Jun
my project is MDI ! i have two view class ,
CStartPageView
andCImageProcessingView
! first application execute OnDraw of CStartPageView because i create document whenOnFileNew
fucntion run i create some object asCImagePorcessingView
.when create new page something that i use inCStartPageView::OnDraw
show in client area ofCImageProcessingView
. i mean every thing i draw in page has affect in another page!although the client area (to view class) is seperable.// in CWinApp::InitInstance // i create to document template : m_pDocTemplate = new CMultiDocTemplate( IDR_ImageProcessingTYPE, RUNTIME_CLASS(CImageProcessingDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CImageProcessingView)); if (!m_pDocTemplate) return FALSE; AddDocTemplate(m_pDocTemplate); m_pDocTemplateStartPage = new CMultiDocTemplate( IDR_ImageProcessingTYPE, RUNTIME_CLASS(CImageProcessingDoc), RUNTIME_CLASS(CChildFrame), RUNTIME_CLASS(CStartPageView)); if (!m_pDocTemplateStartPage) return FALSE; AddDocTemplate(m_pDocTemplateStartPage); in OnFileNew: //create document that class view is CStartPageView CDocument* pDoc = m_pDocTemplateStartPage->OpenDocumentFile(NULL); // & for CImageProcessingView is pDocTemplate->OpenDocument(BULL);
-
my project is MDI ! i have two view class ,
CStartPageView
andCImageProcessingView
! first application execute OnDraw of CStartPageView because i create document whenOnFileNew
fucntion run i create some object asCImagePorcessingView
.when create new page something that i use inCStartPageView::OnDraw
show in client area ofCImageProcessingView
. i mean every thing i draw in page has affect in another page!although the client area (to view class) is seperable.// in CWinApp::InitInstance // i create to document template : m_pDocTemplate = new CMultiDocTemplate( IDR_ImageProcessingTYPE, RUNTIME_CLASS(CImageProcessingDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CImageProcessingView)); if (!m_pDocTemplate) return FALSE; AddDocTemplate(m_pDocTemplate); m_pDocTemplateStartPage = new CMultiDocTemplate( IDR_ImageProcessingTYPE, RUNTIME_CLASS(CImageProcessingDoc), RUNTIME_CLASS(CChildFrame), RUNTIME_CLASS(CStartPageView)); if (!m_pDocTemplateStartPage) return FALSE; AddDocTemplate(m_pDocTemplateStartPage); in OnFileNew: //create document that class view is CStartPageView CDocument* pDoc = m_pDocTemplateStartPage->OpenDocumentFile(NULL); // & for CImageProcessingView is pDocTemplate->OpenDocument(BULL);
mostafa_pasha wrote:
in OnFileNew: //create document that class view is CStartPageView CDocument* pDoc = m_pDocTemplateStartPage->OpenDocumentFile(NULL); // & for CImageProcessingView is pDocTemplate->OpenDocument(BULL);
There are problems in your code. Try this in OnFileNew():
CImageProcessingDoc* pDoc = (CImageProcessingDoc*)m_pDocTemplate->OpenDocumentFile(NULL);
CFrameWnd* pNewFrame = m_pDocTemplateStartPage->CreateNewFrame(pDoc, NULL);
if (pNewFrame != NULL)
{
m_pDocTemplateStartPage->InitialUpdateFrame(pNewFrame, pDoc);
}Best, Jun