Click here to Skip to main content
15,919,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "pDoc->SetTitle" problem Pin
Hamid_RT29-May-07 21:25
Hamid_RT29-May-07 21:25 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint29-May-07 23:40
Aint29-May-07 23:40 
AnswerRe: "pDoc->SetTitle" problem Pin
Nelek31-May-07 6:31
protectorNelek31-May-07 6:31 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint31-May-07 16:06
Aint31-May-07 16:06 
GeneralRe: "pDoc->SetTitle" problem Pin
Nelek1-Jun-07 4:49
protectorNelek1-Jun-07 4:49 
GeneralRe: "pDoc->SetTitle" problem Pin
Rajkumar R31-May-07 19:07
Rajkumar R31-May-07 19:07 
GeneralRe: "pDoc->SetTitle" problem Pin
Aint31-May-07 19:58
Aint31-May-07 19:58 
AnswerRe: "pDoc->SetTitle" problem [modified] Pin
Rajkumar R31-May-07 23:42
Rajkumar R31-May-07 23:42 
Hi,
I reproduced your issue, you are setting the text for the same document instance by pDoc->SetTitle(), this will affect the same string object.
Hence the last string you updated "SECONDVIEW" is the only document title, this is updated to all the views hence the FIRSTVIEW is changed to SECONDVIEW:1;

The frame title of the views are updated by CFrameWnd/CMDIChildWnd::OnUpdateFrameTitle()

we have advanced override for it.
override your frame windows OnUpdateFrameTitle() and do the following
this will set the frame title and overrides the default behaviour.
 <br />
CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)<br />
{<br />
	CString szTitle = m_strTitle;// frame's title<br />
       /* if you need the suffix index do this*/<br />
	if (m_nWindow > 0) // it is views index 1, 2 ...<br />
	{<br />
		szTitle.AppendFormat(_T("%d"), m_nWindow);<br />
	}<br />
<br />
	SetWindowText(szTitle); // set the caption<br />
}<br />


then on your view's OnInitialUpdate() do the following
 <br />
GetParentFrame()->SetTitle(_T("SECONDVIEW")); // your required string<br />

this will set the views frame title which we use at the OnUpdateFrameTitle override
rather than
<br />
pDoc->SetTitle(_T("SECONDVIEW")); // no need<br />



this works verified

Best Regards
May be the same thing will be done by another way.




-- modified at 5:50 Friday 1st June, 2007
GeneralRe: &quot;pDoc-&gt;SetTitle&quot; problem Pin
Aint3-Jun-07 23:59
Aint3-Jun-07 23:59 
AnswerOk, explaining better Pin
Nelek1-Jun-07 4:47
protectorNelek1-Jun-07 4:47 
Question12 digit number calculation Pin
Ram Murali29-May-07 16:47
Ram Murali29-May-07 16:47 
AnswerRe: 12 digit number calculation Pin
Naveen29-May-07 17:01
Naveen29-May-07 17:01 
GeneralRe: 12 digit number calculation Pin
Ram Murali29-May-07 17:23
Ram Murali29-May-07 17:23 
GeneralRe: 12 digit number calculation Pin
Naveen29-May-07 17:33
Naveen29-May-07 17:33 
GeneralRe: 12 digit number calculation Pin
Ram Murali29-May-07 17:34
Ram Murali29-May-07 17:34 
QuestionQuestion about setting Directshow Filter properties Pin
godspeed12329-May-07 12:51
godspeed12329-May-07 12:51 
AnswerRe: Question about setting Directshow Filter properties Pin
Mark Salsbery29-May-07 14:07
Mark Salsbery29-May-07 14:07 
QuestionListview with LVS_ICON style Pin
Perspx29-May-07 12:41
Perspx29-May-07 12:41 
AnswerRe: Listview with LVS_ICON style Pin
Naveen29-May-07 15:03
Naveen29-May-07 15:03 
QuestionRedraw a pane splitter window Pin
gurucplusplus29-May-07 12:16
gurucplusplus29-May-07 12:16 
QuestionProblem on examing a String (token from a file) Pin
Immunity1829-May-07 9:39
Immunity1829-May-07 9:39 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow29-May-07 10:03
David Crow29-May-07 10:03 
AnswerRe: Problem on examing a String (token from a file) Pin
Immunity1829-May-07 20:57
Immunity1829-May-07 20:57 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 2:41
David Crow30-May-07 2:41 
AnswerRe: Problem on examing a String (token from a file) [modified] Pin
Immunity1830-May-07 2:48
Immunity1830-May-07 2:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.