Tab (Windows Controls)

This section contains information about the programming elements used with tab controls.

Overviews

Topic Contents
About Tab Controls A tab control is analogous to the dividers in a notebook or the labels in a file cabinet. By using a tab control, an application can define multiple pages for the same area of a window or dialog box.
Using Tab Controls This topic contains two examples that use tab controls.

Macros

Topic Contents
TabCtrl_AdjustRect Calculates a tab control's display area given a window rectangle, or calculates the window rectangle that would correspond to a specified display area. You can use this macro or send the TCM_ADJUSTRECT message explicitly.
TabCtrl_DeleteAllItems Removes all items from a tab control. You can use this macro or send the TCM_DELETEALLITEMS message explicitly.
TabCtrl_DeleteItem Removes an item from a tab control. You can use this macro or send the TCM_DELETEITEM message explicitly.
TabCtrl_DeselectAll Resets items in a tab control, clearing any that were set to the TCIS_BUTTONPRESSED state. You can use this macro or send the TCM_DESELECTALL message explicitly.
TabCtrl_GetCurFocus Returns the index of the item that has the focus in a tab control. You can use this macro or send the TCM_GETCURFOCUS message explicitly.
TabCtrl_GetCurSel Determines the currently selected tab in a tab control. You can use this macro or send the TCM_GETCURSEL message explicitly.
TabCtrl_GetExtendedStyle Retrieves the extended styles that are currently in use for the tab control. You can use this macro or send the TCM_GETEXTENDEDSTYLE message explicitly.
TabCtrl_GetImageList Retrieves the image list associated with a tab control. You can use this macro or send the TCM_GETIMAGELIST message explicitly.
TabCtrl_GetItem Retrieves information about a tab in a tab control. You can use this macro or send the TCM_GETITEM message explicitly.
TabCtrl_GetItemCount Retrieves the number of tabs in the tab control. You can use this macro or send the TCM_GETITEMCOUNT message explicitly.
TabCtrl_GetItemRect Retrieves the bounding rectangle for a tab in a tab control. You can use this macro or send the TCM_GETITEMRECT message explicitly.
TabCtrl_GetRowCount Retrieves the current number of rows of tabs in a tab control. You can use this macro or send the TCM_GETROWCOUNT message explicitly.
TabCtrl_GetToolTips Retrieves the handle to the tooltip control associated with a tab control. You can use this macro or send the TCM_GETTOOLTIPS message explicitly.
TabCtrl_GetUnicodeFormat Retrieves the UNICODE character format flag for the control. You can use this macro or send the TCM_GETUNICODEFORMAT message explicitly.
TabCtrl_HighlightItem Sets the highlight state of a tab item. You can use this macro or send the TCM_HIGHLIGHTITEM message explicitly.
TabCtrl_HitTest Determines which tab, if any, is at a specified screen position. You can use this macro or send the TCM_HITTEST message explicitly.
TabCtrl_InsertItem Inserts a new tab in a tab control. You can use this macro or send the TCM_INSERTITEM message explicitly.
TabCtrl_RemoveImage Removes an image from a tab control's image list. You can use this macro or send the TCM_REMOVEIMAGE message explicitly.
TabCtrl_SetCurFocus Sets the focus to a specified tab in a tab control. You can use this macro or send the TCM_SETCURFOCUS message explicitly.
TabCtrl_SetCurSel Selects a tab in a tab control. You can use this macro or send the TCM_SETCURSEL message explicitly.
TabCtrl_SetExtendedStyle Sets the extended styles that the tab control will use. You can use this macro or send the TCM_SETEXTENDEDSTYLE message explicitly.
TabCtrl_SetImageList Assigns an image list to a tab control. You can use this macro or send the TCM_SETIMAGELIST message explicitly.
TabCtrl_SetItem Sets some or all of a tab's attributes. You can use this macro or send the TCM_SETITEM message explicitly.
TabCtrl_SetItemExtra Sets the number of bytes per tab reserved for application-defined data in a tab control. You can use this macro or send the TCM_SETITEMEXTRA message explicitly.
TabCtrl_SetItemSize Sets the width and height of tabs in a fixed-width or owner-drawn tab control. You can use this macro or send the TCM_SETITEMSIZE message explicitly.
TabCtrl_SetMinTabWidth Sets the minimum width of items in a tab control. You can use this macro or send the TCM_SETMINTABWIDTH message explicitly.
TabCtrl_SetPadding Sets the amount of space (padding) around each tab's icon and label in a tab control. You can use this macro or send the TCM_SETPADDING message explicitly.
TabCtrl_SetToolTips Assigns a tooltip control to a tab control. You can use this macro or send the TCM_SETTOOLTIPS message explicitly.
TabCtrl_SetUnicodeFormat Sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can use this macro or send the TCM_SETUNICODEFORMAT message explicitly.

Messages

Topic Contents
TCM_ADJUSTRECT Calculates a tab control's display area given a window rectangle, or calculates the window rectangle that would correspond to a specified display area. You can send this message explicitly or by using the TabCtrl_AdjustRect macro.
TCM_DELETEALLITEMS Removes all items from a tab control. You can send this message explicitly or by using the TabCtrl_DeleteAllItems macro.
TCM_DELETEITEM Removes an item from a tab control. You can send this message explicitly or by using the TabCtrl_DeleteItem macro.
TCM_DESELECTALL Resets items in a tab control, clearing any that were set to the TCIS_BUTTONPRESSED state. You can send this message explicitly or by using the TabCtrl_DeselectAll macro.
TCM_GETCURFOCUS Returns the index of the item that has the focus in a tab control. You can send this message explicitly or by using the TabCtrl_GetCurFocus macro.
TCM_GETCURSEL Determines the currently selected tab in a tab control. You can send this message explicitly or by using the TabCtrl_GetCurSel macro.
TCM_GETEXTENDEDSTYLE Retrieves the extended styles that are currently in use for the tab control. You can send this message explicitly or by using the TabCtrl_GetExtendedStyle macro.
TCM_GETIMAGELIST Retrieves the image list associated with a tab control. You can send this message explicitly or by using the TabCtrl_GetImageList macro.
TCM_GETITEM Retrieves information about a tab in a tab control. You can send this message explicitly or by using the TabCtrl_GetItem macro.
TCM_GETITEMCOUNT Retrieves the number of tabs in the tab control. You can send this message explicitly or by using the TabCtrl_GetItemCount macro.
TCM_GETITEMRECT Retrieves the bounding rectangle for a tab in a tab control. You can send this message explicitly or by using the TabCtrl_GetItemRect macro.
TCM_GETROWCOUNT Retrieves the current number of rows of tabs in a tab control. You can send this message explicitly or by using the TabCtrl_GetRowCount macro.
TCM_GETTOOLTIPS Retrieves the handle to the tooltip control associated with a tab control. You can send this message explicitly or by using the TabCtrl_GetToolTips macro.
TCM_GETUNICODEFORMAT Retrieves the Unicode character format flag for the control. You can send this message explicitly or use the TabCtrl_GetUnicodeFormat macro.
TCM_HIGHLIGHTITEM Sets the highlight state of a tab item. You can send this message explicitly or by using the TabCtrl_HighlightItem macro.
TCM_HITTEST Determines which tab, if any, is at a specified screen position. You can send this message explicitly or by using the TabCtrl_HitTest macro.
TCM_INSERTITEM Inserts a new tab in a tab control. You can send this message explicitly or by using the TabCtrl_InsertItem macro.
TCM_REMOVEIMAGE Removes an image from a tab control's image list. You can send this message explicitly or by using the TabCtrl_RemoveImage macro.
TCM_SETCURFOCUS Sets the focus to a specified tab in a tab control. You can send this message explicitly or by using the TabCtrl_SetCurFocus macro.
TCM_SETCURSEL Selects a tab in a tab control. You can send this message explicitly or by using the TabCtrl_SetCurSel macro.
TCM_SETEXTENDEDSTYLE Sets the extended styles that the tab control will use. You can send this message explicitly or by using the TabCtrl_SetExtendedStyle macro.
TCM_SETIMAGELIST Assigns an image list to a tab control. You can send this message explicitly or by using the TabCtrl_SetImageList macro.
TCM_SETITEM Sets some or all of a tab's attributes. You can send this message explicitly or by using the TabCtrl_SetItem macro.
TCM_SETITEMEXTRA Sets the number of bytes per tab reserved for application-defined data in a tab control. You can send this message explicitly or by using the TabCtrl_SetItemExtra macro.
TCM_SETITEMSIZE Sets the width and height of tabs in a fixed-width or owner-drawn tab control. You can send this message explicitly or by using the TabCtrl_SetItemSize macro.
TCM_SETMINTABWIDTH Sets the minimum width of items in a tab control. You can send this message explicitly or by using the TabCtrl_SetMinTabWidth macro.
TCM_SETPADDING Sets the amount of space (padding) around each tab's icon and label in a tab control. You can send this message explicitly or by using the TabCtrl_SetPadding macro.
TCM_SETTOOLTIPS Assigns a tooltip control to a tab control. You can send this message explicitly or by using the TabCtrl_SetToolTips macro.
TCM_SETUNICODEFORMAT Sets the Unicode character format flag for the control. This message allows you to change the character set used by the control at run time rather than having to re-create the control. You can send this message explicitly or use the TabCtrl_SetUnicodeFormat macro.

Notifications

Topic Contents
NM_CLICK (tab) Notifies the parent window of a tab control that the user has clicked the left mouse button within the control. This notification code is sent in the form of a WM_NOTIFY message.
NM_DBLCLK (tab) Notifies a parent window of a tab control that the user has double-clicked the left mouse button within the control. This notification is sent in the form of a WM_NOTIFY message.
NM_RCLICK (tab) Notifies the parent window of a tab control that the user has clicked the right mouse button within the control. This notification code is sent in the form of a WM_NOTIFY message.
NM_RDBLCLK (tab) Notifies the parent window of a tab control that the user has double-clicked the right mouse button within the control. This notification code is sent in the form of a WM_NOTIFY message.
NM_RELEASEDCAPTURE (tab) Notifies a tab control's parent window that the control is releasing mouse capture. This notification code is sent in the form of a WM_NOTIFY message.
TCN_FOCUSCHANGE Notifies a tab control's parent window that the button focus has changed. This notification code is sent in the form of a WM_NOTIFY message.
TCN_GETOBJECT Sent by a tab control when it has the TCS_EX_REGISTERDROP extended style and an object is dragged over a tab item in the control. This notification code is sent in the form of a WM_NOTIFY message.
TCN_KEYDOWN Notifies a tab control's parent window that a key has been pressed. This notification code is sent in the form of a WM_NOTIFY message.
TCN_SELCHANGE Notifies a tab control's parent window that the currently selected tab has changed. This notification code is sent in the form of a WM_NOTIFY message.
TCN_SELCHANGING Notifies a tab control's parent window that the currently selected tab is about to change. This notification code is sent in the form of a WM_NOTIFY message.

Structures

Topic Contents
NMTCKEYDOWN Contains information about a key press in a tab control. It is used with the TCN_KEYDOWN notification code. This structure supersedes the TC_KEYDOWN structure.
TCHITTESTINFO Contains information about a hit test. This structure supersedes the TC_HITTESTINFO structure.
TCITEM Specifies or receives the attributes of a tab item. It is used with the TCM_INSERTITEM, TCM_GETITEM, and TCM_SETITEM messages. This structure supersedes the TC_ITEM structure.
TCITEMHEADER Specifies or receives the attributes of a tab. It is used with the TCM_INSERTITEM, TCM_GETITEM, and TCM_SETITEM messages. This structure supersedes the TC_ITEMHEADER structure.

Constants

Topic Contents
Tab Control Extended Styles The tab control now supports extended styles. These styles are manipulated using the TCM_GETEXTENDEDSTYLE and TCM_SETEXTENDEDSTYLE messages and should not be confused with extended window styles that are passed to CreateWindowEx.
Tab Control Item States Tab control items now support an item state to support the TCM_DESELECTALL message. Additionally, the TCITEM structure supports item state values.
Tab Control Styles This section lists supported tab control styles.