Solved

"fileNewName" in New Doc Template ?

Posted on 1998-10-01
5
413 Views
Last Modified: 2013-11-20
In VC 5.0 samples there is an sample "VIEWEX"
In CViewExApp:InitInstance(), it create five doc template,
In second doc template, it says

// simple color output view
//   a doc template with no 'fileNewName' so it is not a choice for FileNew

I can see nothing different with other four doc template, but why this doc template
with no 'fileNewName'

Here is the source code







/////////////////////////////////////////////////////////////////////////////
// CViewExApp

BOOL CViewExApp::InitInstance()
{
      // Standard initialization
      Enable3dControls();

      // This VIEWEX sample shows several techniques for creating CView
      //  derived classes.   All the views in this sample use the same
      //  CMainDoc class.  For simplicity the CMainDoc class does not
      //  support serialization, but has a very simple data model of
      //  a single string and an RGB color.  We register different
      //  document templates for each of the interesting view types.

      // simple text output view
      AddDocTemplate(new CMultiDocTemplate(IDR_TEXTTYPE,
                  RUNTIME_CLASS(CMainDoc),
                  RUNTIME_CLASS(CMDIChildWnd),
                  RUNTIME_CLASS(CTextView)));

      // simple color output view
      //   a doc template with no 'fileNewName' so it is not a choice for FileNew
      AddDocTemplate(new CMultiDocTemplate(IDR_COLORTYPE,
                  RUNTIME_CLASS(CMainDoc),
                  RUNTIME_CLASS(CMDIChildWnd),
                  RUNTIME_CLASS(CColorView)));

      // form view with input
      AddDocTemplate(new CMultiDocTemplate(IDR_INPUTTYPE,
                  RUNTIME_CLASS(CMainDoc),
                  RUNTIME_CLASS(CMDIChildWnd),
                  RUNTIME_CLASS(CInputView)));

      // splitter frame with both simple text output and form input view
      AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT2TYPE,
                  RUNTIME_CLASS(CMainDoc),
                  RUNTIME_CLASS(CSplitterFrame),
                  RUNTIME_CLASS(CTextView)));

      // 3-way splitter frame with form input, text output and color output views
      AddDocTemplate(new CMultiDocTemplate(IDR_SPLIT3TYPE,
                  RUNTIME_CLASS(CMainDoc),
                  RUNTIME_CLASS(C3WaySplitterFrame),
                  RUNTIME_CLASS(CInputView)));
[.............]
      return TRUE;
}
0
Comment
Question by:Marshal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Bridge
ID: 1322775
In the string table there will be a string for each resourse id; IDR_SPLIT3TYPE, ...

It is here that the difference lies.
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1322776
As said by bridge the difference is in the string table under the key IDR_COLORTYPE.

The key has many strings, each of them means a different thing, you can know what each of them means by checking the doc of the call CDocTemplate::GetDocString.

The difference in your question has to be in the third string.
0
 

Author Comment

by:Marshal
ID: 1322777
Sorry
To Bridge
In String Table  I can not find IDR_COLORTYPE
but for other ID  Just list its value and caption,  What is the difference
In Resource symbols I found IDR_COLORTYPE (it is labeled not in-use)

To plaroche
I can not find any call to CDocTemplate:GetDocString in any classes, Please help me .


0
 
LVL 3

Accepted Solution

by:
plaroche earned 100 total points
ID: 1322778
Your comment answers the question. You cannot find IDR_COLORTYPE therefore it doesn't have a fileNewName defined in the string table.

As for finding GetDocString in the code YOU WON'T. I said that what the strings in the string table means is documented in the help for that call.

For example, in VIEWEX under IDR_TEXTTYPE you see:
\nText\nSimple Text

In that sequence all strings are delimited by a newline caracter \n.  So the first string is empty, the second is "Text" and the third is "Simple Text".

Check the doc for GetDocString, here it is for the first three strings:

CDocTemplate::windowTitle Name that appears in the application window's title bar (for example, "Microsoft Excel"). Present only in the document template for SDI applications.

CDocTemplate::docName Root for the default document name (for example, "Sheet"). This root, plus a number, is used for the default name of a new document of this type whenever the user chooses the New command from the File menu (for example, "Sheet1" or "Sheet2"). If not specified, "Untitled" is used as the default.

CDocTemplate::fileNewName Name of this document type. If the application supports more than one type of document, this string is displayed in the File New dialog box (for example, "Worksheet"). If not specified, the document type is inaccessible using the File New command.


So the first one is for CDocTemplate::windowTitle, the second one "Text" is the docName, and the third one is fileNewName.

Since IDR_COLORTYPE does not have a string in the string table all these entries are empty, since they are all empty then fileNewName is empty, then that's what the comment means in your InitInstance.
0
 

Author Comment

by:Marshal
ID: 1322779
Thank You Very Much, plaroche!!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question