Multiple DocTemplate ???
Pondor -- Pondor@cris.com Monday, April 15, 1996 On Sun, 14 Apr 1996, Sandeep Khamesra wrote: > VC++ 4.0 > Windows 95 > > As u know in MDI application when we click > new menu item it shows a list box which has > shows the list of all document template.. > Is there any by which we can take control of > that list box. What I want to do is In that lisb > box I dont want one entry (DocTemplate) to > appear.. > For ex. I have created 3 MDIDocTemplate.. > Say A, B,C.. > Now when I say New a list box comes whose > contents are A,B,C. But due to some reason, > I dont want A to appear in the List box. > Is it possible ? from what i can tell by burrowing through the source code, it doesn't seem like there is any built-in support for modifying the listbox you speak of. what i suggest doing is overriding the CDocManager::OnFileNew() function (it is virtual) and implementing your own version. you will also have to implement your own version of CNewTypeDlg (the dialog with the listbox). this would be the class where you choose what actually gets included in the listbox. the code for all of this in "DOCMGR.CPP". use it as your reference. one of the best things i like about MFC is that they actually give you the source code. with a little bit of patience, and a lot of debugging, you can actually figure out what the heck those people at MS are trying to do. ;-) good luck! ========================= Phil Chung Pondor@concentric.net 75252.3370@compuserve.com =========================
Jackie Braun -- jbraun@eagle.wbm.ca Wednesday, April 17, 1996 [Mini-digest: 2 responses] >On Sun, 14 Apr 1996, Sandeep Khamesra wrote: > >> VC++ 4.0 >> Windows 95 >> >> As u know in MDI application when we click >> new menu item it shows a list box which has >> shows the list of all document template.. >> Is there any by which we can take control of >> that list box. What I want to do is In that lisb >> box I dont want one entry (DocTemplate) to >> appear.. >> For ex. I have created 3 MDIDocTemplate.. >> Say A, B,C.. >> Now when I say New a list box comes whose >> contents are A,B,C. But due to some reason, >> I dont want A to appear in the List box. >> Is it possible ? > Note: I use VC++ 1.5 (Win 3.1) so I'm not sure if the following holds true for VC++ 4.0 but ... The listbox will display those doctemplates which were explictly registered using "AddDocTemplate()". If you do not register the template, it will not be included in the listbox (nor will it be available for automated doc/view creation). And, also, if you don't register it, remember to delete the "m_pTemplate" pointer in your CWinApp::ExitInstance() function. ----------------------------------------------------------------- Jackie Braun, Ph.D. | Randco Software Corporation Consultant | 2530 Hanover Avenue jbraun@eagle.wbm.ca | Saskatoon SK Phone (306)343-3380 | Canada S7J 1G1 Fax (306)343-3341 ----------------------------------------------------------------- -----From: "Dan McNerthney"You can edit the resource string assoicated with the template and blank the third substring. According to the docs, this will remove it from the FileNew dialog box. example: IDR_A string before: Book\nchecks\nCheck Book\nCheck Book File (*.chb)\n.chb\nChkBookFileType\nCheck Book File Type\nCHBK\nCheck Book Files after: Book\nchecks\n\nCheck Book File (*.chb)\n.chb\nChkBookFileType\nCheck Book File Type\nCHBK\nCheck Book Files The help on CDocTemplate::GetDocString has more details.
| Вернуться в корень Архива |