Function Reference


_GUICtrlListView_SetItemEx

Sets some or all of a item's attributes

#include <GuiListView.au3>
_GUICtrlListView_SetItemEx ( $hWnd, ByRef $tItem )

Parameters

$hWnd Control ID/Handle to the control
$tItem $tagLVITEM structure

Return Value

Success: True.
Failure: False.

Remarks

To set the attributes of an item set the Item member of the $tagLVITEM structure to the index of the item, and set the SubItem member to zero.
For an item, you can set the State, Text, Image, and Param members of the $tagLVITEM structure.

To set the text of a subitem, set the Item and SubItem members to indicate the specific subitem, and use the Text member to specify the text.
You cannot set the State or Param members for subitems because subitems do not have these attributes.

Related

$tagLVITEM, _GUICtrlListView_SetItem

Example

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $tText, $tItem, $idListview

    GUICreate("ListView Set Item Ex", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 100)

    ; Add items
    GUICtrlCreateListViewItem("Item 1", $idListview)
    GUICtrlCreateListViewItem("Item 2", $idListview)
    GUICtrlCreateListViewItem("Item 3", $idListview)

    ; Change item 2
    MsgBox($MB_SYSTEMMODAL, "Information", "Changing item 2")
    $tText = DllStructCreate("wchar Text[11]")
    $tItem = DllStructCreate($tagLVITEM)
    DllStructSetData($tText, "Text", "New Item 2")
    DllStructSetData($tItem, "Mask", $LVIF_TEXT)
    DllStructSetData($tItem, "Item", 1)
    DllStructSetData($tItem, "Text", DllStructGetPtr($tText))
    _GUICtrlListView_SetItemEx($idListview, $tItem)

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