Print Page | Close Window

Change Tab Caption in MDITabWindow Sample

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4939
Printed Date: 11 November 2025 at 2:41am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Change Tab Caption in MDITabWindow Sample
Posted By: hnhd
Subject: Change Tab Caption in MDITabWindow Sample
Date Posted: 31 August 2006 at 1:03pm

Hello,

How to change the caption of a just created tab in MDI App ? I am doing the following but unable to change as m_MTIClientWnd.GetItem returns NULL. Seems that the tab is not yet created. But here if I use the index of an existing tab & after SetCaption I show a MessageBox then the caption is changed till I dismiss the MsgBox. After that the caption reverts back to what is defined in IDR_HELLOTYPE.

Regards

void CMainFrame::OnFileNewhello()
{

 POSITION curTemplatePos = ::AfxGetApp()->GetFirstDocTemplatePosition();

 while(curTemplatePos != NULL)
 {
  CDocTemplate* curTemplate =
   AfxGetApp()->GetNextDocTemplate(curTemplatePos);
  CString str;
  curTemplate->GetDocString(str, CDocTemplate::docName);
  if(str == _T("Hello"))
  {
   CDocument *p = curTemplate->OpenDocumentFile(NULL);
   if (p)
   {
    CXTPTabManagerItem *pTabItem = m_MTIClientWnd.GetItem(m_MTIClientWnd.GetItemCount());
    if (pTabItem)
    {
     pTabItem->SetCaption(_T("SomeCaption"));
    }
   }

   return;
  }
 }
 AfxMessageBox(IDS_NOHELLOTEMPLATE);
}




Replies:
Posted By: Oleg
Date Posted: 31 August 2006 at 4:21pm
Hi,
Just answered in another thread - https://forum.codejock.com/forum_posts.asp?TID=4936 - https://forum.codejock.com/forum_posts.asp?TID=4936


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net