Function Reference


GUICtrlCreateTabItem

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

GUICtrlCreateTabItem ( "text" )

Parameters

text The text of the control.

Return Value

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

Remarks

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.

Related

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

Example

#include <GUIConstantsEx.au3>

Example()

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

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

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

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

    GUICtrlCreateTabItem("tab----1")
    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)

    GUICtrlCreateTabItem("tab2")
    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)

    GUISetState(@SW_SHOW)

    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))
        EndIf
    WEnd
EndFunc   ;==>Example