Function Reference


_GUICtrlHeader_AddItem

Adds a new header item

#include <GuiHeader.au3>
_GUICtrlHeader_AddItem ( $hWnd, $sText [, $iWidth = 50 [, $iAlign = 0 [, $iImage = -1 [, $bOnRight = False]]]] )

Parameters

$hWnd Handle to the control
$sText Item text
$iWidth [optional] Item width
$iAlign [optional] Text alignment:
    0 - Text is left-aligned
    1 - Text is right-aligned
    2 - Text is centered
$iImage [optional] 0-based index of an image within the image list
$bOnRight [optional] If True, the column image appears to the right of text

Return Value

Success: the index of the new item.
Failure: -1.

Related

_GUICtrlHeader_DeleteItem, _GUICtrlHeader_InsertItem

Example

#include <GUIConstantsEx.au3>
#include <GuiHeader.au3>

Example()

Func Example()
        Local $hGUI, $hHeader

        ; Create GUI
        $hGUI = GUICreate("Header", 400, 300)
        $hHeader = _GUICtrlHeader_Create($hGUI)
        _GUICtrlHeader_SetUnicodeFormat($hHeader, True)
        GUISetState(@SW_SHOW)

        ; Add columns
        _GUICtrlHeader_AddItem($hHeader, "Column 1", 100)
        _GUICtrlHeader_AddItem($hHeader, "Column 2", 100)
        _GUICtrlHeader_AddItem($hHeader, "Column 3", 100)
        _GUICtrlHeader_AddItem($hHeader, "Column 4", 100)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example