Solved

"fileNewName" in New Doc Template ?

Posted on 1998-10-01
5
409 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 170
if loop in java 3 174
Hibernate methods 2 87
FizzBuzz challenge 9 87
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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