CPropertySheet::GetTabControl

CTabCtrl* GetTabControl( );

Return Value

A pointer to a tab control.

Remarks

Use this member function to retrieve a pointer to a tab control to do something specific to the tab control (that is, to use any of the APIs in CTabCtrl). For example, call this member function if you want to add bitmaps to each of the tabs during initialization.

Example

// Create and associate a tooltip control to the tab control of
// CMyPropertySheet.  CMyPropertySheet is a CPropertySheet-derived
// class.
BOOL CMyPropertySheet::OnInitDialog()
{
   BOOL bResult = CPropertySheet::OnInitDialog();

   // Create a tooltip control.  m_ToolTipCtrl is a member variable
   // of type CToolTipCtrl* in CMyPropertySheet class.  It is
   // initialized to NULL in the constructor, and destroyed in the
   // destructor of CMyPropertySheet class.
   m_ToolTipCtrl = new CToolTipCtrl;
   if (!m_ToolTipCtrl->Create(this))
   {
      TRACE("Unable To create ToolTip\n");          
      return bResult;
   }

   // Associate the tooltip control to the tab control
   // of CMyPropertySheet.
   CTabCtrl* tab = GetTabControl();
   tab->SetToolTips(m_ToolTipCtrl);

   // Get the bounding rectangle of each tab in the tab control of the
   // property sheet. Use this rectangle when registering a tool with
   // the tool tip control.  IDS_FIRST_TOOLTIP is the first ID string
   // resource that contains the text for the tool.
   int count = tab->GetItemCount();
   int id = IDS_FIRST_TOOLTIP;
   for (int i = 0; i < count; i++)
   {
      id += i;
      CRect r;
      tab->GetItemRect(i, &r);
      VERIFY(m_ToolTipCtrl->AddTool(tab, id, &r, id));
   }

   // Activate the tooltip control.
   m_ToolTipCtrl->Activate(TRUE);

   return bResult;
}

// Override PreTranslateMessage() so RelayEvent() can be
// called to pass a mouse message to CMyPropertySheet's
// tooltip control for processing.
BOOL CMyPropertySheet::PreTranslateMessage(MSG* pMsg)
{
   if (NULL != m_ToolTipCtrl)           
      m_ToolTipCtrl->RelayEvent(pMsg);

   return CPropertySheet::PreTranslateMessage(pMsg);
}

CPropertySheet OverviewClass MembersHierarchy Chart

See Also   CTabCtrl::CTabCtrl