Solved

Unique titles for views

Posted on 1998-06-19
3
195 Views
Last Modified: 2013-11-20
I have several views open on the same document. MFC labels them document:1, document:2 and so on, and changing the document title changes the title of every view. I would like to use a unique title for each view. How can I do that?
0
Comment
Question by:viskju1
3 Comments
 
LVL 2

Accepted Solution

by:
Belgarat earned 100 total points
ID: 1318214
Override virtual member function `void OnUpdateFrameTitle(BOOL bAddToTitle)' defined in CFrameWnd.
The function is called when another frame for the document is opened.
The default implementation generates a text from m_strTitle member, document's name and window's number (in nonvirtual function UpdateFrameTitleForDocument).
You can override the default so that you will not call the inherited function and supply title entirely on your own.
If you're happy with the tittle the frame window get in call to the Create() member function, exclude FWS_ADDTOTITLE flag from the frame window's style - this prevents combining the frame title with the document name.
0
 

Expert Comment

by:YKunisky
ID: 1318215
I 'd have the same problem.

Try to use  CDocument::SetTytle() in every View.


void CYourView::OnInitialUpdate()
{
      CView::OnInitialUpdate();
      
      .........
      GetDocument()->SetTitle("Your name");
                .....
}

0
 

Author Comment

by:viskju1
ID: 1318216
Got it, thank you very much! (Actually I had to override OnUpdateFrameTitle in CMDIChildWnd.)

(- I have tried GetDocument()->SetTitle("Your name") earlier too, but it seems to change the title in all views at once.)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

12 Experts available now in Live!

Get 1:1 Help Now