Function Reference

_GUICtrlListView_DeleteItem

リストビューコントロールからアイテムを削除します。

#Include <GuiListView.au3>
_GUICtrlListView_DeleteItem($hWnd, $iIndex)

 

パラメータ

$hWnd コントロールのコントロールID/ハンドル
$iIndex 削除するリストビューアイテムのゼロ始まりのインデックス

 

返し値

成功: True
失敗: False

 

注意

なし。

 

関連

_GUICtrlListView_DeleteAllItems, _GUICtrlListView_DeleteItemsSelected

 


#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を設定し、他のコントロールのハンドルを使用

Example1()
Example_UDF_Created()

Func Example1()
    Local $hListView

    GUICreate("ListView Delete Item", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    GUISetState()

    ; 3列ロード
    For $iI = 0 To 9
        GUICtrlCreateListViewItem("Item " & $iI & "|Item " & $iI & "-1|Item " & $iI & "-2", $hListView)
    Next

    MsgBox(4160, "Information", "Delete Item")
    ; 組み込み関数を使用して作成したアイテム。コントロールIDを渡す
    MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($hListView, 1))

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

Func Example_UDF_Created()
    Local $GUI, $aItems[10][3], $hListView

    $GUI = GUICreate("(UDF Created) ListView Delete Item", 400, 300)
    $hListView = _GUICtrlListView_Create($GUI, "col1|col2|col3", 2, 2, 394, 268)
    GUISetState()

    ; 3列ロード
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
        $aItems[$iI][1] = "Item " & $iI & "-1"
        $aItems[$iI][2] = "Item " & $iI & "-2"
    Next

    _GUICtrlListView_AddArray($hListView, $aItems)

    MsgBox(4160, "Information", "Delete Item")
    ; 既にハンドル
    MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($hListView, 1))

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