SDI and multiple templates
Dave Kolb -- sasdxk@unx.sas.com Wednesday, May 29, 1996 Environment: VC++ 4.1 with patch / Windows NT 4.0 beta 2 / SDI Application I'm having some problems with an SDI CRichEditView based application trying to use multiple document templates in order to support multiple filetypes such as .txt, .lst and .log files. I'm using the RTF control view in order to view and edit more than 64K on W95. 1. The only CRichEditView example I can find (WORDPAD) is SDI but does not actually use multiple doc templates but implements via a kludge instead. 2. Should I create a separate template for each filetype (e.g. .lst, .txt, .log) where they are all basically text types and can use the same doc, view and frame class but I only want to use different resources (toolbar and menus) for each? Or should I kludge like WORDPAD does? Seems like SDI is supposed to support multiple document templates. 3. If I do #2 above using multiple templates and the CSingleDocTemplate constructor takes a resource id that implies a toolbar resource, why must the frame's OnCreate() hardcode the toolbar resource anyway? This implies that I cannot share a single frame class in the multiple document templates I use to support multiple filetypes that only need different toolbars and menus. I hate to have a separate frame class for each file type only because I want a different toolbar for some types. Do I kludge CFrameWnd::OnCreate() to look at the document file type to load a toolbar even though the template knows which resource was selected? 4. I get another new frame/doc/view each time I open another file type rather than resuse the same frame or replace the frame as I think should happen with SDI. If I open the same file type then I reuse the existing doc/frame/view for that type as is normal for SDI. Any suggestions and insights much appreciated. I guess I could probably fix most of this stuff with MDI but don't want to do that for certain reasons right now. Does SDI REALLY support multiple templates? Thanks, Dave Kolb Compuserve: 72410,407@compuserve.com SAS Institute, Inc. EMAIL: sasdxk@unx.sas.com SAS Campus Drive - R3282 Phone: (919) 677-8000 x6827 Cary, NC 27513-2414 USA FAX: (919) 677-8123
Larry Siden -- lsiden@jade.bioimage.com Monday, June 03, 1996 I had a similar problem. My SDI app displays bitmaps. I wanted it to be able to open either a normal .bmp file or a proprietary bitmap format (.bio) that our company created. I wanted to register two different templates, so that the template would dynamically create the right document type depending on what file the user opened. But it never worked. I don't remember where it kept hitting the wall (I think the library kept asserting somewhere), but people on the list who replied to me told me that SDI wasn't set up to handle this type of situation and that I could make it work only by doing a lot of overriding, which I wasn't prepared to do at the time. I was using VC++ 1.5. -- Larry Siden, Senior Software Engineer phone: 313-930-9900 x211 (w) Bio Image, Inc. fax: 313-930-0990 777 E. Eisenhower Pky, Suite 950 email: (w) lsiden@bioimage.com Ann Arbor, MI 48108 (h) Larry_Siden@msn.com
| Вернуться в корень Архива |