Function Reference


Creates a TabItem control within an existing tab control in the GUI.

GUICtrlCreateTabItem ( "text" )


text The text of the control.

Return Value

Success: the identifier (controlID) of the new control.
Failure: 0.


To select a specific tabitem to be shown when the GUI opens use GUICtrlSetState(-1, $GUI_SHOW) as shown in the example.

It is important to close the tab structure by creating a final tabitem control with a null text - GUICtrlCreateTabItem("").

Controls for a specific tabitem should be created after the tabitem and before the creating a further tabitem or closing the tab structure. To create a new control on an existing tabitem, use GUISwitch($hWin, $tabitem) to select the correct tabitem and then create the new control. Do not forget to close the tabitem structure once again with GUICtrlCreateTabItem("").

The tabitem control cannot be colored (too much code ...).

GUICtrlRead() will return the index of the clicked tab item, or the controlID when advanced mode is used.

To set or change information in the control see GUICtrlUpdate...() functions.


GUICtrlCreateTab, GUICtrlRead, GUICtrlSetState, GUIEventOptions (Option), GUIGetMsg, GUISwitch


#include <GUIConstantsEx.au3>


Func Example()
    GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered

    GUISetFont(9, 300)

    Local $idTab = GUICtrlCreateTab(10, 10, 200, 100)

    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    GUICtrlCreateInput("default", 80, 50, 70, 20)

    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo|guinness", "Jon"); default Jon
    GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    GUICtrlSetState(-1, $GUI_SHOW); will be display first
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem(""); end tabitem definition

    GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)


    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
        If $idMsg = $idTab Then
            ; display the clicked tab
            WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($idTab))
EndFunc   ;==>Example