Share via


CTabCtrl::InsertItem

BOOLInsertItem(intnItem**,TCITEM*pTabCtrlItem);**

BOOL InsertItem( int nItem**, LPCTSTR** lpszItem );

BOOL InsertItem( int nItem**, LPCTSTR** lpszItem**, int** nImage );

BOOL InsertItem( UINT nMask**, int** nItem**, LPCTSTR** lpszItem**, int** nImage**, LPARAM** lParam );

Return Value

Zero-based index of the new tab if successful; otherwise  – 1.

Parameters

nItem

Zero-based index of the new tab.

pTabCtrlItem

Pointer to a structure that specifies the attributes of the tab.

lpszItem

Pointer to the item to insert.

nImage

The zero-based index of an image to insert from an image list.

nMask

Specifies which TCITEM structure attributes to set. Can be zero or a combination of the following values:

  • TCIF_TEXT   The pszText member is valid.

  • TCIF_IMAGE   The iImage member is valid.

  • TCIF_PARAM   The lParam member is valid.

  • TCIF_RTLREADING   The text of pszText is displayed using right-to-left reading order on Hebrew or Arabic systems.

  • TCIF_STATE   The dwState member is valid.

lParam

Application-defined data associated with the tab.

Remarks

Call this function to insert a new tab in an existing tab control.

Example

BOOL CDialogDlg::OnInitDialog()
{
   // Other initialization.

   TCITEM tcItem;
   tcItem.mask = TCIF_TEXT;
   tcItem.pszText = _T("Tab #1");

   m_tabCtrl.InsertItem(0, &tcItem);

   return TRUE;  // Return TRUE unless you set the focus to a control.
}

CTabCtrl OverviewClass MembersHierarchy Chart

See Also   CTabCtrl::GetItem, CTabCtrl::SetItem