Function Reference


_GUICtrlListView_AddArray

Adds items from an array to the control

#include <GuiListView.au3>
_GUICtrlListView_AddArray ( $hWnd, ByRef $aItems )

Parameters

$hWnd Control ID/Handle to the control
$aItems Array with the following format:
    [0][0] - Item 1 Text
    [0][1] - Item 1 Subitem 1 text
    [0][2] - Item 1 Subitem 2 text
    [0][n] - Item 1 Subitem n text
    [1][0] - Item 2 Text
    [1][1] - Item 2 Subitem 1 text
    [1][2] - Item 2 Subitem 2 text
    [1][n] - Item 2 Subitem n text

Return Value

None.

Example

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

Example()

Func Example()
    Local $iI, $iTimer, $idListview

    ; Create GUI
    GUICreate("ListView Add Array", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Items", 100)
    _GUICtrlListView_AddColumn($idListview, "SubItems 1", 100)
    _GUICtrlListView_AddColumn($idListview, "SubItems 2", 100)
    _GUICtrlListView_AddColumn($idListview, "SubItems 3", 100)

    _GUICtrlListView_SetItemCount($idListview, 5000)

    ; One column load
    Local $aItems[5000][1]
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
    Next
    $iTimer = TimerInit()
    _GUICtrlListView_AddArray($idListview, $aItems)
    MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($idListview)) ; items added with UDF function can be deleted using UDF function

    ; Four column load
    Local $aItems[5000][4]
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
        $aItems[$iI][1] = "Item " & $iI & "-1"
        $aItems[$iI][2] = "Item " & $iI & "-2"
        $aItems[$iI][3] = "Item " & $iI & "-3"
    Next
    $iTimer = TimerInit()
    _GUICtrlListView_AddArray($idListview, $aItems)
    MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

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