Share via


CMFCTabCtrl Class

The CMFCTabCtrl class provides functionality for a tab control. The tab control displays a dockable window with flat or three-dimensional tabs at its top or bottom. The tabs can display text and an image and can change color when active.

class CMFCTabCtrl : public CMFCBaseTabCtrl

Members

Public Constructors

Name

Description

CMFCTabCtrl::CMFCTabCtrl

Default constructor.

CMFCTabCtrl::~CMFCTabCtrl

Destructor.

Public Methods

Name

Description

CMFCTabCtrl::ActivateMDITab

Displays the specified tab of the current tab control and sets the focus on that tab.

CMFCTabCtrl::AllowDestroyEmptyTabbedPane

 

CMFCTabCtrl::AutoSizeWindow

Specifies whether the framework is to resize the client area of all tab control windows when a user interface element of the tab control changes.

CMFCTabCtrl::CalcRectEdit

Deflates the size of the specified tab area. (Overrides CMFCBaseTabCtrl::CalcRectEdit.)

CMFCTabCtrl::Create

Creates the tab control and attaches it to the CMFCTabCtrl object.

CMFCTabCtrl::CreateObject

Used by the framework to create a dynamic instance of this class type.

CMFCTabCtrl::EnableActiveTabCloseButton

Shows or hides a Close button (X) on the active tab.

CMFCTabCtrl::EnableInPlaceEdit

Enables or disables editable tab labels. (Overrides CMFCBaseTabCtrl::EnableInPlaceEdit.)

CMFCTabCtrl::EnableTabDocumentsMenu

Replaces two buttons that scroll the window tabs with a button that opens a menu of tabbed windows.

CMFCTabCtrl::EnsureVisible

Ensures that a tab is visible.

CMFCTabCtrl::GetDocumentIcon

Retrieves the symbol that is associated with a tab in a popup menu of tabbed windows.

CMFCTabCtrl::GetFirstVisibleTabNum

Retrieves the index of the first tab that is visible in the current tab control.

CMFCTabCtrl::GetResizeMode

Retrieves a value that specifies how the current tab control can be resized.

CMFCTabCtrl::GetScrollBar

Retrieves a pointer to the scroll bar object that is associated with the tab control.

CMFCTabCtrl::GetTabArea

Retrieves the bounding rectangle of the tab label area at the top or bottom of the tab control. (Overrides CMFCBaseTabCtrl::GetTabArea.)

CMFCTabCtrl::GetTabFromPoint

Retrieves the tab that contains a specified point. (Overrides CMFCBaseTabCtrl::GetTabFromPoint.)

CMFCTabCtrl::GetTabMaxWidth

Retrieves the maximum width of a tab.

CMFCTabCtrl::GetTabsHeight

Retrieves the height of the tab area of the current tab control.

CMFCTabCtrl::GetTabsRect

Retrieves a rectangle that bounds the tab area of the current tab control. (Overrides CMFCBaseTabCtrl::GetTabsRect.)

CMFCTabCtrl::GetThisClass

Used by the framework to obtain a pointer to the CRuntimeClass object that is associated with this class type.

CMFCTabCtrl::GetWndArea

Retrieves the boundary of the client area of the current tab control.

CMFCTabCtrl::HideActiveWindowHorzScrollBar

Hides the horizontal scroll bar, if any, of the active window.

CMFCTabCtrl::HideInactiveWindow

Specifies whether the framework is to display inactive tab control windows.

CMFCTabCtrl::HideNoTabs

Enables or disables drawing the tab area if there are no visible tabs.

CMFCTabCtrl::HideSingleTab

Enables or disables drawing a tab when there is a single tabbed window. (Overrides CMFCBaseTabCtrl::HideSingleTab.)

CMFCTabCtrl::IsActiveInMDITabGroup

Indicates whether the current tab of a tab control is the active tab in an multiple document interface tab group.

CMFCTabCtrl::IsActiveTabBoldFont

Indicates whether the text of the active tab is displayed using a bold font.

CMFCTabCtrl::IsActiveTabCloseButton

Indicates whether the Close button (X) is displayed on an active tab or the upper-right corner of the tab area.

CMFCTabCtrl::IsDrawFrame

Indicates whether the tabbed window draws a frame rectangle around embedded panes.

CMFCTabCtrl::IsFlatFrame

Indicates whether the frame around the tab area is flat or 3D.

CMFCTabCtrl::IsFlatTab

Indicates whether the appearance of the tabs in the current tab control is flat or not.

CMFCTabCtrl::IsLeftRightRounded

Indicates whether the appearance of the left and right side of a tab in the current tab control is rounded.

CMFCTabCtrl::IsMDITabGroup

Indicates whether the current tab control is contained in the client area of a multiple-document interface window.

CMFCTabCtrl::IsOneNoteStyle

Indicates whether the current tab control is displayed in the style of Microsoft OneNote.

CMFCTabCtrl::IsPtInTabArea

Determines if a point is inside the tab area. (Overrides CMFCBaseTabCtrl::IsPtInTabArea.)

CMFCTabCtrl::IsSharedScroll

Indicates whether the current tab control has a scroll bar that can scroll its tabs as a group.

CMFCTabCtrl::IsTabDocumentsMenu

Indicates whether the tab control displays scroll buttons or a button that displays a menu of tabbed windows.

CMFCTabCtrl::IsVS2005Style

Indicates whether tabs are displayed in the style of Visual Studio .NET 2005.

CMFCTabCtrl::ModifyTabStyle

Specifies the appearance of tabs in the current tab control.

CMFCTabCtrl::MoveTab

Moves a tab to another tab position. (Overrides CMFCBaseTabCtrl::MoveTab.)

CMFCTabCtrl::OnDragEnter

Called by the framework when the cursor is first dragged into the tab control window.

CMFCTabCtrl::OnDragOver

Called by the framework during a drag operation when the mouse is moved over the drop target window. (Overrides CMFCBaseTabCtrl::OnDragOver.)

CMFCTabCtrl::OnShowTabDocumentsMenu

Displays a popup menu of tabbed windows, waits until the user selects a tab, and makes the selected tab the active tab.

CMFCTabCtrl::PreTranslateMessage

Translates window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CMFCBaseTabCtrl::PreTranslateMessage.)

CMFCTabCtrl::RecalcLayout

Recalculates the internal layout of the tab control. (Overrides CMFCBaseTabCtrl::RecalcLayout.)

CMFCTabCtrl::SetActiveInMDITabGroup

Sets the current tab of a tab control as the active tab in an multiple document interface tab group.

CMFCTabCtrl::SetActiveTab

Activates a tab. (Overrides CMFCBaseTabCtrl::SetActiveTab.)

CMFCTabCtrl::SetActiveTabBoldFont

Enables or disables use of a bold font on active tabs.

CMFCTabCtrl::SetDrawFrame

Enables or disables drawinga frame rectangle around an embedded bar.

CMFCTabCtrl::SetFlatFrame

Specifies whether to draw a flat or a 3D frame around the tab area.

CMFCTabCtrl::SetImageList

Specifies an image list. (Overrides CMFCBaseTabCtrl::SetImageList.)

CMFCTabCtrl::SetResizeMode

Specifies how the current tab control can be resized and then redisplays the control.

CMFCTabCtrl::SetTabMaxWidth

Specifies the maximum tab width in a tabbed window.

CMFCTabCtrl::StopResize

Terminates the current resize operation on the tab control.

CMFCTabCtrl::SwapTabs

Swaps a pair of tabs. (Overrides CMFCBaseTabCtrl::SwapTabs.)

CMFCTabCtrl::SynchronizeScrollBar

Draws a horizontal scroll bar on a tab control that displays flat tabs.

Data Members

Name

Description

CMFCTabCtrl::m_bEnableActivate

Prevents the active view from losing focus when a new tab is inserted and enabled.

Remarks

The CMFCTabCtrl class supports:

  • Tab control styles that include 3D, flat, and flat with a shared horizontal scroll bar.

  • Tabs located at the top or the bottom of the window.

  • Tabs that display text, images, or text and images.

  • Tabs that change color when the tab is active.

  • Border size changes for adjustable tabs.

  • Detachable tabbed windows.

The CMFCTabCtrl class can be used with a dialog box, but is intended for applications that use docking control bars like Microsoft Excel and Visual Studio. For more information, see CDockablePane Class.

Follow these steps to add a resizable, docking tab control in your application:

  1. Create an instance of CTabbedPane Class.

  2. Call CDockablePane::Create.

  3. Use CBaseTabbedPane::AddTab or CMFCBaseTabCtrl::InsertTab to add new tabs.

  4. Call CBasePane::EnableDocking so that the current docking tab control can dock at the main frame window.

  5. Call CFrameWndEx::DockPane to dock the tabbed window at the main frame.

For an example of how to create a tabbed window as a docking control bar, see CTabbedPane Class. To use CMFCTabCtrl as a non-docking control, create a CMFCTabCtrl object and then call CMFCTabCtrl::Create.

Inheritance Hierarchy

CObject

   CCmdTarget

      CWnd

         CMFCBaseTabCtrl

            CMFCTabCtrl

Example

The following example demonstrates how to use various methods in the CMFCTabCtrl class to configure a CMFCTabCtrl object. The example explains how to add a tab, show the Close button on the active tab, enable editable tab labels, and display a pop-up menu of tabbed window labels. This example is part of the State Collection sample.

    CMFCTabCtrl m_wndTabs;


...


    // Attach list windows to tab:
    // CListCtrl m_wndList1
    // CListCtrl m_wndList2
    // CListCtrl m_wndList3
    m_wndTabs.AddTab (&m_wndList1, _T("Output 1"), (UINT)-1);
    m_wndTabs.AddTab (&m_wndList2, _T("Output 2"), (UINT)-1);
    m_wndTabs.AddTab (&m_wndList3, _T("Output 3"), (UINT)-1);

    m_wndTabs.EnableActiveTabCloseButton();
    m_wndTabs.EnableInPlaceEdit(true);
    m_wndTabs.EnableTabDocumentsMenu();
    m_wndTabs.SetActiveTab(1);
    m_wndTabs.SetDrawFrame();
    m_wndTabs.SetFlatFrame();

Requirements

Header: afxtabctrl.h

See Also

Reference

Hierarchy Chart

CDockablePane Class

CDockablePane Class

CMFCBaseTabCtrl Class

Other Resources

MFC Classes