Solved

"fileNewName" in New Doc Template ?

Posted on 1998-10-01
5
394 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now