Function Reference


_GUICtrlHeader_InsertItem

Inserts a new header item

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

Parameters

$hWnd Handle to the control
$iIndex Index of the item after which the new item is to be inserted.
The new item is inserted at the end of the control if index is greater than or equal to the number of items in the control.
If index is zero, the new item is inserted at the beginning of the control.
$sText Item text. See remark.
$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.

Remarks

If a notification callback is needed, you have to specify $sText = -1 (LPSTR_TEXTCALLBACK).

Related

_GUICtrlHeader_AddItem, _GUICtrlHeader_DeleteItem

Example

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

Example()

Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Header Insert Item (v" & @AutoItVersion & ")", 400, 300)
        Local $hHeader = _GUICtrlHeader_Create($hGUI)
        _GUICtrlHeader_SetUnicodeFormat($hHeader, True)
        GUISetState(@SW_SHOW)

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

        ; Insert new column
        _GUICtrlHeader_InsertItem($hHeader, 1, "Column X", 100, 2)

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