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

Remarks

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

Related

_GUICtrlTab_Destroy

Example

Example : Created with UDF

#include <Extras\WM_NOTIFY.au3>
#include <GUIConstantsEx.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>

Global $g_hTab

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Tab Create (v" & @AutoItVersion & ")", 400, 300)
        $g_hTab = _GUICtrlTab_Create($hGUI, 2, 2, 396, 296)
        GUISetState(@SW_SHOW)

        _WM_NOTIFY_Register()

        ; Add tabs
        _GUICtrlTab_InsertItem($g_hTab, 0, "Tab 1")
        _GUICtrlTab_InsertItem($g_hTab, 1, "Tab 2")
        _GUICtrlTab_InsertItem($g_hTab, 2, "Tab 3")

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
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