[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

"fileNewName" in New Doc Template ?

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
Marshal
Asked:
Marshal
  • 2
  • 2
1 Solution
 
BridgeCommented:
In the string table there will be a string for each resourse id; IDR_SPLIT3TYPE, ...

It is here that the difference lies.
0
 
plarocheCommented:
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
 
MarshalAuthor Commented:
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
 
plarocheCommented:
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
 
MarshalAuthor Commented:
Thank You Very Much, plaroche!!!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now