Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
[^][^]I created MDI Tabbed Document application using below code

CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area
mdiTabParams.m_bTabIcons = FALSE; //set to TRUE to enable document icons on MDI tabs
mdiTabParams.m_bAutoColor = TRUE; //set to FALSE to disable auto-coloring of MDI tabs
mdiTabParams.m_bDocumentMenu = TRUE;
EnableMDITabbedGroups(TRUE, mdiTabParams);

How to change each tab title?By default each tab is named with document title?I want to display only part of document name as tab title so how to achieve it?
I want to set different names for tab caption and document.

For e.g

Document name is Main Logic - Std PLC

Tab Caption should be Main Logic.

I will use this Document name in frame title

What I have tried:

THe solution to my problem is given in this thread

https://social.msdn.microsoft.com/Forums/en-US/78c9a0dc-8bf4-4f07-8c0d-90cf6a5fbcb1/how-to-place-an-asterix-on-an-mdi-tabbed-document-window-to-indicate-that-the-document-was?forum=vcmfcatl[^]

void CiMyMDIChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
   CiMyDoc* pDocument = STATIC_DOWNCAST(CiMyDoc, GetActiveDocument());
   CString sDocTitle;
   if (pDocument && !pDocument->GetTitle().IsEmpty() && pDocument->IsModified())
   {
      sDocTitle=pDocument->m_strTitle; //this requires CiMyDoc to friend class CiMyMDIChildFrame;
      pDocument->m_strTitle=pDocument->GetTitle()+"*";
   }
   CMDIChildWndEx::OnUpdateFrameTitle(bAddToTitle);
   if (!sDocTitle.IsEmpty()) pDocument->m_strTitle=sDocTitle;
}



But CDocument's class m_strTitle is protected member so I am unable to use this solution.
Posted
Updated 23-Mar-17 3:50am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900