?
Solved

"fileNewName" in New Doc Template ?

Posted on 1998-10-01
5
Medium Priority
?
417 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 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