Function Reference


_GUICtrlListView_SetItemCount

Causes the list-view control to allocate memory for the specified number of items

#include <GuiListView.au3>
_GUICtrlListView_SetItemCount ( $hWnd, $iItems )

Parameters

$hWnd Control ID/Handle to the control
$iItems Number of items that the list-view control will ultimately contain

Return Value

Success: True.
Failure: False.

Remarks

Causes the control to allocate its internal data structures for the specified number of items.
This prevents the control from having to allocate the data structures every time an item is added.

Related

_GUICtrlListView_GetItemCount

Example

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

Example()

Func Example()
    Local $idListview

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

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

    ; Add items
    _GUICtrlListView_SetItemCount($idListview, 100)
    _GUICtrlListView_BeginUpdate($idListview)
    For $x = 1 To 100
        GUICtrlCreateListViewItem("Item " & $x, $idListview)
    Next
    _GUICtrlListView_EndUpdate($idListview)

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