Jump to content

List View - cannot delete the list view items using _GUICtrlListView_DeleteAllItems function


Recommended Posts

post-50561-1245792022_thumb.png

HI plp,

I want to delete the list view items using the function _GUICtrlListView_DeleteAllItems

But i cant since I loaded the array values in the ListView.

Code: _GUICtrlListView_DeleteAllItems($hListView)

_GUICtrlListView_AddArray($hListView, $aRow2)

When i put this code in a loop, instead of updating the Listview, the rows in the listview gets added up....

How to delete the ListView items completly without destroying the Listview....

Please see the attachment for a visual, which gives more understandings.....

post-50561-1245792022_thumb.png

Link to comment
Share on other sites

I have checked it once again, and I think I the error is

_GUICtrlListView_DeleteAllItems($hListView)

_GUICtrlListView_AddArray($hListView, $aRow2)

For $index = _GUICtrlListView_GetItemCount($hListView) - 1 To 0 Step -1

_GUICtrlListView_DeleteItem($hListView, $index)

$ctrlID = _GUICtrlListView_GetItemParam($hListView, $index)

If $ctrlID Then GUICtrlDelete($ctrlID)

msgbox (0,"$ctrlID","$ctrlID = "&$ctrlID&" $index = "&$index &" Item Count = "&_GUICtrlListView_GetItemCount($hListView))

Next

Link to comment
Share on other sites

I have checked it once again, this approach also doesnt work....

Code :-

_GUICtrlListView_DeleteAllItems($hListView)

_GUICtrlListView_AddArray($hListView, $aRow2)

For $index = _GUICtrlListView_GetItemCount($hListView) - 1 To 0 Step -1

_GUICtrlListView_DeleteItem($hListView, $index)

$ctrlID = _GUICtrlListView_GetItemParam($hListView, $index)

If $ctrlID Then GUICtrlDelete($ctrlID)

msgbox (0,"$ctrlID","$ctrlID = "&$ctrlID&" $index = "&$index &" Item Count = "&_GUICtrlListView_GetItemCount($hListView))Next

Link to comment
Share on other sites

I have checked it once again, this approach also doesnt work....

Code :-

If you enclose your AutoIt code with [ autoit ] code [ /autoit ] you will get the following (a bit easier to look at :D )

_GUICtrlListView_DeleteAllItems($hListView)
_GUICtrlListView_AddArray($hListView, $aRow2)

For $index = _GUICtrlListView_GetItemCount($hListView) - 1 To 0 Step -1
   _GUICtrlListView_DeleteItem($hListView, $index)
   $ctrlID = _GUICtrlListView_GetItemParam($hListView, $index)
   If $ctrlID Then GUICtrlDelete($ctrlID)
   msgbox (0,"$ctrlID","$ctrlID = "&$ctrlID&" $index = "&$index &" Item Count = "&_GUICtrlListView_GetItemCount($hListView))
Next

Everseeker

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...