Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Change Tab Caption in MDITabWindow Sample
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Change Tab Caption in MDITabWindow Sample

 Post Reply Post Reply
Author
Message
hnhd View Drop Down
Newbie
Newbie


Joined: 10 July 2006
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote hnhd Quote  Post ReplyReply Direct Link To This Post Topic: Change Tab Caption in MDITabWindow Sample
    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);
}

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 4:21pm
Hi,
Just answered in another thread - https://forum.codejock.com/forum_posts.asp?TID=4936
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.062 seconds.