doc/view from a wizard
Dan Edwards -- dedwards@silvercrk.com Monday, February 10, 1997 Environment: Visual C++ 4.2b Win95, WinNT, Mac Hello, I've got a dialog based app, a wizard, that I want to display a doc/view frame from one of the pages. My question is, how do I create and display the doc/view frame from a function in the wizard? Thanks Dan
David Little -- dlittle@equinoxcorp.com Wednesday, February 12, 1997 [Mini-digest: 2 responses] I have done something similar, but not from a wizard. I don't see why it would be different, though. This is how I did it: 1. Register a document type in the CWinApp:InitInstance() as normal. 2. Also in the InitInstance, use ShowWindow(FALSE) to hide the CMainFrame. 3. Post a WM_COMMAND message to CMainFrame that will call your wizard, like this: pMainFrame->ShowWindow(SW_HIDE); pMainFrame->UpdateWindow(); pMainFrame->PostMessage(WM_COMMAND, ID_INPUT_AUXINPUT); 4. In your wizard, when you get to the step where you want to open a document, show the mainframe and open your document: CMainFrame* mf = (CMainFrame*)GetParentFrame(); mf->m_bPlot = TRUE; mf->ShowWindow(TRUE); AfxGetApp()->OpenDocumentFile(sSomeFileName); That's it....pretty easy.... ---------- From: Dan Edwards[SMTP:dedwards@silvercrk.com] Sent: Tuesday, February 11, 1997 1:56 AM To: mfc-l@netcom.com Subject: doc/view from a wizard Environment: Visual C++ 4.2b Win95, WinNT, Mac Hello, I've got a dialog based app, a wizard, that I want to display a doc/view frame from one of the pages. My question is, how do I create and display the doc/view frame from a function in the wizard? Thanks Dan -----From: Mike BlaszczakAt 23:56 2/10/97 -0800, Dan Edwards wrote: >Environment: Visual C++ 4.2b Win95, WinNT, Mac >I've got a dialog based app, a wizard, that I want to display a doc/view >frame from one of the pages. My question is, how do I create and display >the doc/view frame from a function in the wizard? MFC doesn't support that directly. You'll need to instantiate the document, create the view (parenting it to the wizard page) and associate the view to the document yourself, manually. You'll then find out why MFC doesn't support this: you'll need to add some code to the property sheet to handle keyboard and mouse focus and activation. (ie, you'll need to write some code that lets the user tab away from tab stops in your document and set focus to the buttons on the wizard page, and vice versa.) This special case code will add up pretty quickly, and MFC doesn't incldue it becasue what you're doing isn't a very common idea. .B ekiM http://www.nwlink.com/~mikeblas/ These words are my own. I do not speak on behalf of Microsoft. This performance was not lip-synched.
Ronald D. Patton -- rpatton@sky.net Wednesday, February 12, 1997 Dan, In a nutshell you will probably want to derive classes from CFrameWnd, CView and CDocument (Note: depending on whether you want MDI or SDI select the appropriate CFrameWnd). Then you can create a Template (again MDI or SDI) that corresponds to the Runtime Type of your derived objects. This template is then capable of creating a doc/view frame from CDocTemplate::CreateNewFrame. BTW, Mike Blaszczak has a book that covers this topic very well. Check out "The Revolutionary Guide to MFC 4 Programming with Visual C++", Chap 4. Ron Patton ---------- > From: Dan Edwards> To: mfc-l@netcom.com > Subject: doc/view from a wizard > Date: Tuesday, February 11, 1997 1:56 AM > > Environment: Visual C++ 4.2b Win95, WinNT, Mac > > Hello, > > I've got a dialog based app, a wizard, that I want to display a doc/view > frame from one of the pages. My question is, how do I create and display > the doc/view frame from a function in the wizard? > > Thanks > Dan > >
Become an MFC-L member | Вернуться в корень Архива |