﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1639	Unable to delete ListviewItems created with _GUICtrlListView_AddItem	Emiel Wieldraaijer		"Hi,

The code below with ""_GUICtrlListView_AddItem"" does not allow a listview item to be removed from the listview. If i use  GUICtrlCreateListViewItem the item can be removed. 

Thanks

Best regards,

Emiel

{{{
#Region
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Add_Constants=n
#EndRegion

#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
#Include <GuiImageList.au3>

Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES,$LVS_EX_CHECKBOXES)

$GUI = GUICreate (""Test"", 400,300)
$Tab = GUICtrlCreateTab(10,10, 380,280)
$Tab1 = GUICtrlCreateTabItem(""Tab1"")

$List = GUICtrlCreateListView ("""", 20,40,360,200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($list, $exStyles)

_AddDrives ()


$Button1 = GUICtrlCreateButton(""Delete"", 280, 260, 100, 20)
$Button2 = GUICtrlCreateButton(""Add"", 180, 260, 100, 20)
$Tab2 = GUICtrlCreateTabItem(""Tab2"")
GuiCtrlCreateLabel(""Tab 2"", 20,40,100,20)

GUISetState ()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
For $i = 1 to 26
	_GUIImageList_AddIcon($hImage, @SystemDir & ""\shell32.dll"", 110 + $i)
Next
_GUICtrlListView_SetImageList($list, $hImage, 1)

_GUICtrlListView_AddColumn($list, ""Drive"", 85)
_GUICtrlListView_AddColumn($list, ""Column 2"", 85)
_GUICtrlListView_AddColumn($list, ""Column 3"", 85)
_GUICtrlListView_AddColumn($list, ""Column 4"", 85)

While 1
 $msg = GUIGetMsg()
	If $msg = $GUI_EVENT_CLOSE Then Exit
 	Switch $msg
		Case -3
			ExitLoop
		Case -50 To 0
			ContinueLoop
		Case $msg = 0
		Case $Button1
			_GUICtrlListView_DeleteAllItems($list)
		Case $Button2
			_AddDrives()
	EndSwitch
Wend

Func _AddDrives ()
	$DriveSet = """"
	$DriveSet = DriveGetDrive(""ALL"")
	For $i = 1 to $DriveSet[0]
		 ; Unable to delete lines created with this
		_GUICtrlListView_AddItem($list, StringUpper($driveset[$i]), 0 + $i)
		; But able to delete lines created with this, disable the above line
		; GUICtrlCreateListViewItem(StringUpper($DriveSet[$i]), $list)
	Next
EndFunc
}}}
"	Bug	closed		AutoIt	3.3.6.1	None	No Bug	Delete Listview _GUICtrlListView_AddItem _GUICtrlListView_DeleteAllItems	
