naming Tabs for the CTabCtrl in a FormView SDI

I have a SDI application with a FormView.  I have placed the Tab Control on this form and I am able to create the Tabs.  
I have not been able to place a name on each of these tabs.
This is the code I am using:

void CSDIView::OnInitialUpdate()
{

             TC_ITEM TabItem;

CFormView::OnInitialUpdate();

  TabItem.pszText = "Tab 1";// This code has no effect.
  m_LineNum.InsertItem( 0, &TabItem );
  TabItem.pszText = "Tab 2";
  m_LineNum.InsertItem( 1, &TabItem );
  TabItem.pszText = "Tab 3";
  m_LineNum.InsertItem( 2, &TabItem );

              GetParentFrame()->RecalcLayout();
      ResizeParentToFit();
}

Can you please tell me what I have forgotten to do and help me label these tabs?

Thank you for your help
drodgersAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
abk102299Connect With a Mentor Commented:
Hi Drodgers,

You forgot to assign the value to the TabItem.mask field. Look carefully to the reference for the TCITEM structure description. The code may be as following:

CSDIView::OnInitialUpdate()
{

             TC_ITEM TabItem;

CFormView::OnInitialUpdate();

  // The pszText member is valid !!!
  TabItem.mask = TCIF_TEXT;

  TabItem.pszText = "Tab 1";// This code has no effect.
  m_LineNum.InsertItem( 0, &TabItem );
  TabItem.pszText = "Tab 2";
  m_LineNum.InsertItem( 1, &TabItem );
  TabItem.pszText = "Tab 3";
  m_LineNum.InsertItem( 2, &TabItem );

              GetParentFrame()->RecalcLayout();
ResizeParentToFit();
}
0
All Courses

From novice to tech pro — start learning today.