Function Reference

_GUICtrlListView_AddArray

配列を使用してコントロールへアイテムを追加します。

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

 

パラメータ

$hWnd コントロールのハンドル
$aItems 次のフォーマットの配列:
[0][0] - アイテム1のテキスト
[0][1] - アイテム1のサブアイテム1のテキスト
[0][2] - アイテム1のサブアイテム2のテキスト
[0][n] - アイテム1のサブアイテムnのテキスト
[1][0] - アイテム2のテキスト
[1][1] - アイテム2のサブアイテム1のテキスト
[1][2] - アイテム2のサブアイテム2のテキスト
[1][n] - アイテム2のサブアイテムnのテキスト

 

返し値

なし。

 

注意

なし。

 

関連

 


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; ListView関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用

_Main()

Func _Main()
    Local $iI, $iTimer, $hListView

    ; GUI作成
    GUICreate("ListView Add Array", 400, 300)
    $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    _GUICtrlListView_SetUnicodeFormat($hListView, False)
    GUISetState()

    ; 列を追加
    _GUICtrlListView_AddColumn($hListView, "Items", 100)
    _GUICtrlListView_AddColumn($hListView, "SubItems 1", 100)
    _GUICtrlListView_AddColumn($hListView, "SubItems 2", 100)
    _GUICtrlListView_AddColumn($hListView, "SubItems 3", 100)

    _GUICtrlListView_SetItemCount($hListView, 5000)

    ; 1列ロード
    Local $aItems[5000][1]
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
    Next
    $iTimer = TimerInit()
    _GUICtrlListView_AddArray($hListView, $aItems)
    MsgBox(4160, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView)) ; UDF関数で追加されたアイテムはUDF関数を使用して削除できる

    ; 4列ロード
    Dim $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($hListView, $aItems)
    MsgBox(4160, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

    ; ユーザーが終了するまでループ
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main