Function Reference


_GUICtrlHeader_SetItemWidth

Sets the item's width

#include <GuiHeader.au3>
_GUICtrlHeader_SetItemWidth ( $hWnd, $iIndex, $iWidth )

Parameters

$hWnd Handle to the control
$iIndex 0-based item index
$iWidth New width for item

Return Value

Success: True.
Failure: False.

Related

_GUICtrlHeader_GetItemWidth

Example

Example 1

#include "Extras\HelpFileInternals.au3"

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

Example()

Func Example()
    ; Create GUI
    Local $hGUI = GUICreate("Header Get/Set ItemWidth (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)

    ; Set column 0 width
    _GUICtrlHeader_SetItemWidth($hHeader, 0, 130)

    ; Show column 0 width
    _MemoWrite("Column 0 width: " & _GUICtrlHeader_GetItemWidth($hHeader, 0))

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

EndFunc   ;==>Example

Example 2 : Header Set ItemWidth to an External process

#include "Extras\HelpFileInternals.au3"

#include <GuiHeader.au3>

Example()

Func Example()
    Local $sFromTo
    Local $hWin = _MemoRunAU3OutProcess($sFromTo, True) ; OK also if run in different mode

    Local $hHeader = _MemoCreateOutProcess($hWin, "SysHeader32", 1, $sFromTo)

    _MemoMsgBox($MB_SYSTEMMODAL, "Information", "About to set item width")

    ; Set column 0 param
    _GUICtrlHeader_SetItemWidth($hHeader, 0, 100)

    ; Show column 0 param
    _MemoWrite("Column 0 width: " & _GUICtrlHeader_GetItemWidth($hHeader, 0))

    _MemoMsgBoxStatus("", Default, $hWin) ; no more action, wait GUI for closing

EndFunc   ;==>Example