Jump to content
Sign in to follow this  
Nithyanandam

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

Recommended Posts

Nithyanandam

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

Share this post


Link to post
Share on other sites
Nithyanandam

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

Share this post


Link to post
Share on other sites
Nithyanandam

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

Share this post


Link to post
Share on other sites
ReFran

Fom helpfile:

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))

HTH, Reinhard

Share this post


Link to post
Share on other sites
everseeker

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

Share this post


Link to post
Share on other sites
everseeker

Member number 50,561?

Good lord, I feel old!


Everseeker

Share this post


Link to post
Share on other sites
Nithyanandam

Fom helpfile:

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))

HTH, Reinhard

Thanks, it works perfect now....

Sasikumar

Share this post


Link to post
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
Sign in to follow this  

×