# Function Reference

# _GUICtrlTab_Create

Create a TabControl control

#include <GuiTab.au3>
_GUICtrlTab_Create ( $hWnd, $iX, $iY [, $iWidth = 150 [, $iHeight = 150 [, $iStyle = 0x00000040 [, $iExStyle = 0x00000000]]]] )

## Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control styles: $TCS_BOTTOM - Tabs appear at the bottom of the control $TCS_BUTTONS - Tabs appear as buttons, and no border is drawn around the display area $TCS_FIXEDWIDTH - All tabs are the same width $TCS_FLATBUTTONS - Selected tabs appear as being indented into the background while other tabs appear as being on the same plane as the background. This only affects tab controls with the $TCS_BUTTONS style. $TCS_FOCUSNEVER - The control does not receive the input focus when clicked $TCS_FOCUSONBUTTONDOWN - The control receives the input focus when clicked $TCS_FORCEICONLEFT - Icons are aligned with the left edge of each fixed width tab. This style can only be used with the $TCS_FIXEDWIDTH style. $TCS_FORCELABELLEFT - Labels are aligned on the left edge of each fixed width tab. The label is displayed immediately to the right of the icon instead of being centered. This style can only be used with the $TCS_FIXEDWIDTH style and it implies the $TCS_FORCEICONLEFT style. $TCS_HOTTRACK - Items under the pointer are automatically highlighted. You can check whether or not hot tracking is enabled by calling SystemParametersInfo. $TCS_MULTILINE - Multiple rows of tabs are displayed, if necessary, so all tabs are visible at once $TCS_MULTISELECT - Multiple tabs can be selected by holding down the CTRL key when clicking. This style must be used with the $TCS_BUTTONS style. $TCS_OWNERDRAWFIXED - The parent window is responsible for drawing tabs $TCS_RAGGEDRIGHT - Rows of tabs will not be stretched to fill the entire width of the control. This style is the default. $TCS_RIGHT - Tabs appear vertically on the right side of controls that use the $TCS_VERTICAL style. This value equals $TCS_BOTTOM. This style is not supported if you use visual styles. $TCS_RIGHTJUSTIFY - The width of each tab is increased, if necessary, so that each row of tabs fills the entire width of the tab control. This style is ignored unless the $TCS_MULTILINE style is also specified. $TCS_SCROLLOPPOSITE - Unneeded tabs scroll to the opposite side of the control when a tab is selected $TCS_SINGLELINE - Only one row of tabs is displayed. The user can scroll to see more tabs, if necessary. This style is the default. $TCS_TABS - Tabs appear as tabs, and a border is drawn around the display area. This style is the default. $TCS_TOOLTIPS - The tab control has a ToolTip control associated with it $TCS_VERTICAL - Tabs appear at the left side of the control with tab text displayed vertically. This style is valid only when used with the $TCS_MULTILINE style. To make tabs appear on the right side of the control, also use the $TCS_RIGHT style. Default: $TCS_HOTTRACK Forced: $WS_CHILD, $WS_CLIPSIBLINGS, $WS_VISIBLE
$iExStyle | [optional] Control extended styles: $TCS_EX_FLATSEPARATORS - The control will draw separators between the tab items $TCS_EX_REGISTERDROP - The control generates $TCN_GETOBJECT notification messages to request a drop target object when an object is dragged over the tab items.

## Return Value

Success: | Handle to the control
Failure: | 0
@error: | -1 - $hwnd is invalid. 2 - the $hwnd windows does not exist. 4 - the $hWnd referenced Window is not in the same process. 8 - too many control defined. 16 - more than 16 windows have been referenced.

## Remarks

This function is for Advanced users and for learning how the control works.

## Related

_GUICtrlTab_Destroy

## Example

### Example 1

    ; =; == Example 1 : Created with UDF

    #include "Extras\HelpFileInternals.au3"
    #include "Extras\WM_NOTIFY.au3"

    #include <GUIConstantsEx.au3>
    #include <GuiTab.au3>
    #include <WindowsStylesConstants.au3>

    Global $g_hTab

    Example()

    Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Tab Create (v" & @AutoItVersion & ")", 450, 300, 100, 100)
        $g_hTab = _GUICtrlTab_Create($hGUI, 2, 2, 446, 266)
        _MemoMsgBoxStatus() ; Status creation

        GUISetState(@SW_SHOW)

        _WM_NOTIFY_Register()

        _MemoMsgBox($MB_SYSTEMMODAL, "Information", "Create 3 Tabs")
        ; Add tabs
        _GUICtrlTab_InsertItem($g_hTab, 0, "Tab 0")
        _GUICtrlTab_InsertItem($g_hTab, 1, "Tab 1")
        _GUICtrlTab_InsertItem($g_hTab, 2, "Tab 2")

        _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

    EndFunc   ;==>Example

    Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
        #forceref $hWnd, $iMsg, $wParam
        Local $hWndTab = $g_hTab
        If Not IsHWnd($g_hTab) Then $hWndTab = GUICtrlGetHandle($g_hTab)

        Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
        Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
        Local $iCode = DllStructGetData($tNMHDR, "Code")
        Switch $hWndFrom
            Case $hWndTab
                Switch $iCode
                    Case $NM_CLICK ; The user has clicked the left mouse button within the control
                        _WM_NOTIFY_DebugEvent("$NM_CLICK", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; The return value is ignored by the tab control
                    Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                        _WM_NOTIFY_DebugEvent("$NM_DBLCLK", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; Return 1 ; nonzero to not allow the default processing
                        Return 0 ; zero to allow the default processing
                    Case $NM_RCLICK ; The user has clicked the right mouse button within the control
                        _WM_NOTIFY_DebugEvent("$NM_RCLICK", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; Return 1 ; nonzero to not allow the default processing
                        Return 0 ; zero to allow the default processing
                    Case $NM_RDBLCLK ; The user has double-clicked the right mouse button within the control
                        _WM_NOTIFY_DebugEvent("$NM_RDBLCLK", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; Return 1 ; nonzero to not allow the default processing
                        Return 0 ; zero to allow the default processing
                    Case $NM_RELEASEDCAPTURE ; control is releasing mouse capture
                        _WM_NOTIFY_DebugEvent("$NM_RELEASEDCAPTURE", $tagNMHDR, $lParam, "hWndFrom,IDFrom")
                        ; No return value
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_NOTIFY

### Example (OutProcess) : Tab Create to an External process

    #include "Extras\HelpFileInternals.au3"

    #include <GuiTab.au3>
    #include <MsgBoxConstants.au3>

    Example()

    Func Example()
        Local $sFromTo
        Local $hWin = _MemoRunAU3OutProcess($sFromTo, False)
        _MemoCreateOutProcess($hWin, "SysTabControl32", 2, $sFromTo)

        _GUICtrlTab_Create($hWin, 2, 2, 446, 266)

        If @error Then _MemoMsgBox($MB_ICONERROR, "Info" & $sFromTo, "@error=" & @error & " _GUICtrlTab_Create()" & @CRLF & @TAB & "cannot be used for an external process")

        _MemoMsgBoxStatus("", -1, $hWin) ; no more action, wait GUI for closing

    EndFunc   ;==>Example