# Function Reference

# _GUICtrlHeader_OrderToIndex

Retrieves an index value for an item based on its order

#include <GuiHeader.au3>
_GUICtrlHeader_OrderToIndex ( $hWnd, $iOrder )

## Parameters

$hWnd | Handle to the control
$iOrder | Order in which the item appears within the header control, from left to right

## Return Value

Success: | the item index.
Failure: | $iOrder.

## Example

    #include "Extras\HelpFileInternals.au3"

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

    Example()

    Func Example()
        ; Create GUI
        Local $hGUI = GUICreate("Header OrderToIndex (v" & @AutoItVersion & ")", 450, 300, 100, 100)
        Local $hHeader = _GUICtrlHeader_Create($hGUI)
        _MemoCreate(2, 52, 444, 220)

    ;~  _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)
        _GUICtrlHeader_AddItem($hHeader, "Column 3", 100)

        ; Show the index for order 2
        _MemoWrite("Order 2 index: " & _GUICtrlHeader_OrderToIndex($hHeader, 2))

        _MemoMsgBoxStatus("", -1, $hGUI) ; no more action, wait GUI for closing

    EndFunc   ;==>Example